Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome net::ERR_INCOMPLETE_CHUNKED_ENCODING error

For the past two months, I have been receiving the following error on Chrome's developer console:

net::ERR_INCOMPLETE_CHUNKED_ENCODING

Symptoms:

  • Pages not loading.
  • Truncated CSS and JS files.
  • Pages hanging.

Server environment:

  • Apache 2.2.22
  • PHP
  • Ubuntu

This is happening to me on our in-house Apache server. It is not happening to anybody else - i.e. None of our users are experiencing this problem - nor is anybody else on our dev team.

Other people are accessing the exact same server with the exact same version of Chrome. I have also tried disabling all extensions and browsing in Incognito mode - to no effect.

I have used Firefox and the exact same thing is occurring. Truncated files and whatnot. The only thing is, Firefox doesn't raise any console errors so you need to inspect the HTTP request via Firebug to see the problem.

Response Headers from Apache:

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Mon, 27 Apr 2015 10:52:52 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:Apache/2.2.22 (Ubuntu)
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.10-1ubuntu3.8

While testing, I was able to fix the issue by forcing HTTP 1.0 in my htaccess file:

SetEnv downgrade-1.0

This gets rid of the problem. However, forcing HTTP 1.0 over HTTP 1.1 is not a proper solution.

Update: Because I'm the only one experiencing this issue, I figured that I needed to spend more time investigating whether or not it was a client side issue. If I go into Chrome's settings and use the "Restore to Default" option, the problem will disappear for about 10-20 minutes. Then it returns.

like image 396
Wayne Whitty Avatar asked Oct 15 '22 20:10

Wayne Whitty


People also ask

What is chunked encoding error?

Users receive a "chunked encoding upload is not supported on the HTTP/1.0 protocol". Just looking to see if this is a problem with our data or workflow. This happens on a Vault Get and does not repeat if we close vault and try again.

What is ERR_ INCOMPLETE_ CHUNKED_ ENCODING?

Some users failed to load resource: net:: ERR_INCOMPLETE_CHUNKED_ENCODING when using Google Chrome. When this issue occurs, website pages hang or fail to load correctly, and Google Chrome displays a blank page. JavaScript and CSS files are also truncated, creating issues with the web form submission.


2 Answers

OK. I've triple-tested this and I am 100% sure that it is being caused by my anti-virus (ESET NOD32 ANTIVIRUS 5).

Whenever I disable the Real-Time protection, the issue disappears. Today, I left the Real-Time protection off for 6-7 hours and the issue never occurred.

A few moments ago, I switched it back on, only for the problem to surface within a minute.

Over the course of the last 24 hours, I have switched the Real-Time protection on and off again, just to be sure. Each time - the result has been the same.

Update: I have come across another developer who had the exact same problem with the Real-Time protection on his Kaspersky anti-virus. He disabled it and the problem went away. i.e. This issue doesn't seem to be limited to ESET.

like image 84
Wayne Whitty Avatar answered Oct 17 '22 08:10

Wayne Whitty


The error is trying to say that Chrome was cut off while the page was being sent. Your issue is trying to figure out why.

Apparently, this might be a known issue impacting a couple of versions of Chrome. As far as I can tell, it is an issue of these versions being massively sensitive to the content length of the chunk being sent and the expressed size of that chunk (I could be far off on that one). In short, a slightly imperfect headers issue.

On the other hand, it could be that the server does not send the terminal 0-length chunk. Which might be fixable with ob_flush();. It is also possible that Chrome (or connection or something) is being slow. So when the connection is closed, the page is not yet loaded. I have no idea why this might happen.

Here is the paranoid programmers answer:

<?php
    // ... your code
    flush();
    ob_flush();
    sleep(2);
    exit(0);
?>

In your case, it might be a case of the script timing out. I am not really sure why it should affect only you but it could be down to a bunch of race conditions? That's an utter guess. You should be able to test this by extending the script execution time.

<?php
    // ... your while code
    set_time_limit(30);
    // ... more while code
?>

It also may be as simple as you need to update your Chrome install (as this problem is Chrome specific).

  • https://code.google.com/p/chromium/issues/detail?id=461213
  • IIS & Chrome: failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
  • https://wordpress.org/support/topic/interface-issue-err_incomplete_chunked_encoding

UPDATE: I was able to replicate this error (at last) when a fatal error was thrown while PHP (on the same localhost) was output buffering. I imagine the output was too badly mangled to be of much use (headers but little or no content).

Specifically, I accidentally had my code recursively calling itself until PHP, rightly, gave up. Thus, the server did not send the terminal 0-length chunk - which was the problem I identified earlier.

like image 54
Matthew Brown aka Lord Matt Avatar answered Oct 17 '22 09:10

Matthew Brown aka Lord Matt