Search code examples
curlapache2chunking

Chunking Request Issues Out Of Nowhere on Chrome, Firefox, and cURL


Out of seemingly nowhere my production server is getting a chunking error on a specific request. No config files have been changed on the server and nothing else on the server has changed. I'm not even sure where to start in debugging this error.

This chunking error only happens on 1 GET request with query params.

On Chrome the error is: net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (Ok).

To make sure this was not a Chrome specific issue, I tried on Firefox but the same thing happens although with a different error SyntaxError: JSON.parse: unterminated string at line . Inspecting the response shows that Firefox is receiving some of the JSON from the request, but not all of it.

On the server I used cURL to GET the URL with the exact same query params and got this error: ncurl: (18) transfer closed with outstanding read data remaining. If I use HTTP 1.0 nothing changes, but if I add the header "Expect: " , at some point the request stops receiving data.

cURL is not the issue here, I need this request to work with the Javascript AJAX request. The file that makes this request has not been altered for 7 months.

The expected return of this request is between 50 - 200 rows from the database. If I do a SELECT query directly on the database, there is no problem.

Where do I start to look? Log files have no information of interest and the server has plenty of memory and cpu.

Our server is Ubuntu 16.04 and Apache 2.4. Our API is DreamFactory; no settings there have been changed either.


Solution

  • Changing opcache.fast_shutdown=0 in my php.ini file seems to have fixed this. Apache's error_log was getting a new line that read zend_mm_heap corrupted on every request where I was having this issue.

    See this question