State Saving causing sporadic and quiet errors

State Saving causing sporadic and quiet errors

austinwangaustinwang Posts: 4Questions: 0Answers: 0
edited April 2013 in Bug reports
We are using datatables to list out users' contacts. When a row is click, an ajax call is made and contact details are rendered. Users love it!

We enabled statesaving, and it works great for keeping sorted and filtered contacts. However, we are seeing that after a certain number of successful requests (anywhere from 3-100+) the requests will start failing. Subsequently, cache and cookies must be cleared before any requests originating from the datatable can be made again. I'm not sure what info would be most helpful, so here's a list of our observations

-Datatables debugger code: idiboh
-All failed requests get a response status "0"
-User is still logged in and other requests can still be made (contact actions, control panel) so I don't think it is related to devise/login or CSRF
-Deleting the sprymedia datatables cookie specifically can fix the problem
-setting bStatesave as false fixes the issue.
-After the requests start failing, future requests do not even hit the server. The browser seems to stop it.
-After requests start failing, even non AJAX requests for contacts will fail (no data received error)
-Happens more frequently on production than on localhost/development but still replicatable on both
-Chrome seems to be the most resilient (most requests before fail), followed by firefox, then safari.

Happy to provide any other information anyone thinks might be helpful.

Austin

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Great to hear that DataTables is being well received by your users.

    My guess (its only a guess without a test case) is that the cookie length is going over 4KiB and the server is rejecting it. You could try using localStorage (which will be the default in DataTables 1.10): http://datatables.net/blog/localStorage_for_state_saving

    Allan
  • austinwangaustinwang Posts: 4Questions: 0Answers: 0
    Wonderful. Thank you Allan, I didnt think of that. I'll give it a try and report back.
  • austinwangaustinwang Posts: 4Questions: 0Answers: 0
    Hi Allan, I gave this a shot and it worked great with a few kinks. It saves the scroll data and requests it correctly, however the actual location of the scroll on load is at the beginning. If i trigger fnDraw , it goes to the right place, but doesn't load that way. I am using scroller and have implemented these instructions:
    http://datatables.net/blog/localStorage_for_state_saving

    Right now I just have a workaround to call fnDraw(false); immediately after datatable initialization on load, but that is an extra request.
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Are you able to link me to your page? Scrolling with state saving should work correctly: http://datatables.net/release-datatables/extras/Scroller/state_saving.html . With server-side processing it will almost certainly require two ajax gets, but it shouldn't need you to call fnDraw(false) (nice workaround though).

    Regards,
    Allan
This discussion has been closed.