Ok guys, answering my own question here, but I have found the solution.
I was using a custom file servlet written by @BalusC; and the problem was therein
Here are my findings:
- The issue appears when using a combination of
Content-Encoding: gzip
and Content-Range
- The resulting error is:
ERR_INCOMPLETE_CHUNKED_ENCODING
- I first decided to disable this filter and let tomcat's
DefaultServlet
handle it... problem gone
- being a programmer, I had to know why.
- I still don't have the exact reason, but I think it is because gzip cannot be accurately represented with a length
The spec for Content-Range
also states that:
The Content-Range entity-header is sent with a partial entity-body to specify where in the full entity-body the partial body should be applied. Range units are defined in section 3.12.
And within the code, it was sent even if it was the full response:
if (ranges.isEmpty() || ranges.get(0) == full) {
// Return full file.
Range r = full;
response.setContentType(contentType);
response.setHeader("Content-Range", "bytes " + r.start + "-" + r.end + "/" + r.total);
if (content) {
// .....
I removed that line, and everything started working again! I would really like someone to chip in on this and possibly give a better explanation.
Here is the chrome://net-internals/
output of a file that failed:
t= 3740 [st= 38] -HTTP_STREAM_REQUEST
t= 3740 [st= 38] +HTTP_TRANSACTION_SEND_REQUEST [dt=0]
t= 3740 [st= 38] HTTP_TRANSACTION_SEND_REQUEST_HEADERS
--> GET /Core/resources/scripts/scriptaculous/dragdrop.js?t=1461139610 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
DNT: 1
Referer: http://localhost:8080/Core/Dashboard?componentID=VCmq3c
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,af;q=0.6
Cookie: [306 bytes were stripped]
t= 3740 [st= 38] -HTTP_TRANSACTION_SEND_REQUEST
t= 3740 [st= 38] +HTTP_TRANSACTION_READ_HEADERS [dt=4]
t= 3740 [st= 38] HTTP_STREAM_PARSER_READ_HEADERS [dt=4]
t= 3744 [st= 42] HTTP_TRANSACTION_READ_RESPONSE_HEADERS
--> HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: inline;filename="dragdrop.js"
Accept-Ranges: bytes
ETag: dragdrop.js_19250_1461136271305
Last-Modified: Wed, 20 Apr 2016 07:11:11 GMT
Expires: Wed, 27 Apr 2016 08:06:51 GMT
Content-Range: bytes 0-19249/19250
Content-Type: application/javascript
Transfer-Encoding: chunked
Vary: Accept-Encoding
Date: Wed, 20 Apr 2016 08:06:50 GMT
t= 3744 [st= 42] -HTTP_TRANSACTION_READ_HEADERS
t= 3744 [st= 42] HTTP_CACHE_WRITE_INFO [dt=56]
t= 3800 [st= 98] HTTP_CACHE_WRITE_DATA [dt=0]
t= 3800 [st= 98] HTTP_CACHE_WRITE_INFO [dt=1]
t= 3801 [st= 99] URL_REQUEST_DELEGATE [dt=0]
t= 3801 [st= 99] -URL_REQUEST_START_JOB
t= 3801 [st= 99] URL_REQUEST_DELEGATE [dt=0]
t= 3801 [st= 99] HTTP_TRANSACTION_READ_BODY [dt=0]
t= 3801 [st= 99] HTTP_CACHE_WRITE_DATA [dt=1]
t= 3802 [st= 100] URL_REQUEST_JOB_BYTES_READ
--> byte_count = 3683
t= 3802 [st= 100] HTTP_TRANSACTION_READ_BODY [dt=0]
t= 3802 [st= 100] HTTP_CACHE_WRITE_DATA [dt=0]
t= 3802 [st= 100] URL_REQUEST_JOB_BYTES_READ
--> byte_count = 13982
t= 3802 [st= 100] HTTP_TRANSACTION_READ_BODY [dt=20365]
--> net_error = -355 (ERR_INCOMPLETE_CHUNKED_ENCODING)
t=24167 [st=20465] FAILED
--> net_error = -355 (ERR_INCOMPLETE_CHUNKED_ENCODING)
t=24168 [st=20466] -REQUEST_ALIVE
--> net_error = -355 (ERR_INCOMPLETE_CHUNKED_ENCODING)
And, finally, here are some links that really helped me, seems spring had the same problem last year.
I still cannot figure out why this randomly started after running fine for years and would really appreciate any input.