State Saving causing sporadic and quiet errors
State Saving causing sporadic and quiet errors
![austinwang](https://secure.gravatar.com/avatar/7830ffea9475c7ab460d453478e4c800/?default=https%3A%2F%2Fvanillicon.com%2F7830ffea9475c7ab460d453478e4c800_200.png&rating=g&size=120)
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
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
This discussion has been closed.
Replies
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
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.
Regards,
Allan