Hi everyone, I’ve been stuck on this issue for a while now, but unsure if it’s a bug, and even if it’s really play causing it.
My production setup is a Play 2.8.5 installation behind a Nginx proxy on an up to date Ubuntu 18.04 server; it only happens there, and not in local development (even when also proxied via a local nginx)
For a small but important part of our application, the client side code sends a POST request to the server containing a form encoded as multipart-formdata, consisting of a single multiple selection field witch possibly many (>1000) selected values. Upon receiving such request, the play server has the relevant action process these values, constructing either a string or bytearray (depending on the url), and returning these with the corresponding mime type etc.
Now for the weird problem: if I select few values, I can repeatedly get a successful response to my requests; likewise, if I request a large number of values followed by a smaller number, or a small number followed by a larger number of values, there seems to be no problem; however, as soon as I send multiple requests containing a large number of values (even if I wait for the first one to finish before sending the next), I get the correct response to the first, but the server crashes on the second with a
NotEnoughDataException. This obscure exception, about which I can hardly find any info, occurs in the processing of the
MultipartFormData (stack trace can be found at pastebin.com/E2JPQuPB).
Because of its request-size-dependent behavior, I thought it would be a buffer issue, but I increased
play.http.parser.maxDiskBuffer to multiple times the request size, without avail. Moreover, the first request always returns ok, no matter it’s size, and I thought requests are supposed to be independent on one another (and thus the buffer used by the first request would not be used for the second request).
Another strange aspect of the error is that the
NotEnoughDataException only becomes fatal because it leads to a
NoClassDefFoundError, meaning it could not initialize the
NotEnoughDataException class. This is obvious, since it is, in fact, an object. But when looking to the code, I cannot find any place where it refers to it as a class.
To summarize: I can not fathom what is happening here, and since it happens before any of our own code, I don’t know how to diagnose it further.
Any ideas would be much appreciated!