Play Framework 1.2.5 Decent error: 324 no data

I have an application running in Play Framework 1.2.5 with multiple users.

Sometimes a user starts to get 324 errors for a specific URL that worked on them a few minutes before. (324 = NO DATA RECEIVED IN CHROME, THE SERVER CLOSED THE CONNECTION in IE8). After receiving these messages, they continue to receive an error.

I see how the request reaches the machine on which the Play Framework is running (via Wireshark), but the request does not seem to reach the Play controller. (debug and trace messages as a first step in the controller do not get log output). I saw that the problem occurs for two different controllers, this can affect more.

Clearing the browser cache, history, rebooting the client, restarting Play, rebooting the server does not seem to matter.

Other browsers may successfully use the broken URL. Broken clients can visit other URLs in the same application.

Does anyone know: 1) Know why this can happen, or have seen the same problem, or 2) Does anyone know where in the answer chain Play can bomb or send 324? 2) How can I more closely track what is going wrong (for example, can I track Netty access?)

I was looking high and wide for similar problems with solutions and I can only find links to errors in the routes file that cause a similar error 324, but they all seem consistent and repeatable and are associated with Play 2.x. But the fact that a bad route can cause 324 errors means that I would like to know in more detail what the Router does for these broken requests.

Any help is much appreciated! It drives me crazy!

+4
source share
1 answer

Well, just in case, if anyone else sees this problem of homelessness ... I tracked the reason:

Root cause

A known issue in Netty 3.2.4-FINAL means that it responds with a 324 response if the request contains a cookie of 8053 bytes or more. This is known in the Play Framework community (see http://play.lighthouseapp.com/projects/57987/tickets/1618-long-cookies-with-double-quote-values-make-play-fail-before-the- request-is-handled ). You will notice that in the comment chain there the double-quote problem has been fixed, but the size problem remains.

My business

So how did I manage to create a cookie that is large? Answer: JQuery Datatable. This fantastic user interface element (no, really) has a โ€œbStateSaveโ€ parameter that allows you to save the state (ordering, filtering, etc.) of the Tables in a cookie to improve user experience. A cookie for data is about 900 bytes. However, Datatables uses part of the path for the URL in the name of this cookie, so for each URL in your application you get a new cookie. Now just add the RESTful style URL, for example / item / show / 34 (where 34 is the object identifier) โ€‹โ€‹and hey-presto, one cookie of 900 bytes for each item you are viewing into the mix. This will soon break the 8K limit.

Answer

Overriding the datatables state cookie name is not trivial, but it is quite simple.

First add the following configuration to your datatable

"bStateSave": true, "fnStateSave": function(oSettings, oData) { save_dt_view(oSettings, oData); }, "fnStateLoad": function(oSettings) { return load_dt_view(oSettings); }, 

Then just provide javascript functions that will store and retrieve state using your own less accurate cookie name:

 function save_dt_view (oSettings, oData) { $.cookie('DataTables_myCookie', JSON.stringify(oData)); } function load_dt_view (oSettings) { return JSON.parse( $.cookie('DataTables_myCookie') ); } 

Thanks to bennybenben in this post for sample code that I cannibalised.

+2
source

All Articles