Incomplete Chunked Encoding Error Chrome / Specific PCs

Liam Webster picture Liam Webster · Apr 8, 2015 · Viewed 26.3k times · Source

We develop various websites for clients and have recently experienced a strange problem with a few of our "heavier" websites.

A couple of our Magento stores, and 1 other PHP based website only on my PC and 1 client's PC have been failing to load on Chrome and other browsers with the console error:

net::ERR_INCOMPLETE_CHUNKED_ENCODING

This error is usually shown on various JS files such as: /js/magentothem/jquery-ui.js

On refresh you can reproduce the same error multiple times, and then occasionally the site will load fine.

If you open the JS file in a separate tab the file clearly cuts off at a random point (i.e. isn't loaded fully), but after multiple refreshes will load cleanly.

It isn't just 1 file in question - it varies between JS files - the files are uploaded correctly to the server.

We have 4 PCs in the office, and it only happens on mine, but also weirdly on one of our client's machines with the same error.

We all run the same version of Chrome (including the machines that work fine).

After investigation... - If I change my network cable to one of the others previously connected to a PC receiving the page fine, I still get the error

- If I disconnect my network cable and HotSpot to my iPhone network, the sites load fine!

I have tried disabling all forms of caching on the server, and checking error logs, all to no avail.

Can anyone shed any light on what this issue could be related to? I am convinced this error is not server related - and could be a coincidence between mine and my client's PC, but what is the question...

Thanks in advance

Answer

syed picture syed · Jul 12, 2016

I was getting the exact same error "net::ERR_INCOMPLETE_CHUNKED_ENCODING" when accessing my PERL CGI script from an android phone. CGI page is being served from Apache 2.4.6 server.

To clarify the CGI script was working perfectly in IE/Chrome/FF and on Blackberry handset.

The fix was to specify the Content-length in the HTTP header to stop chunking from happening.

Here is my example, which I hope will be useful to someone as I searched online for pointers for almost two days without any avail.

#!/usr/local/bin/perl

use CGI;
use CGI qw( :standard );
my $body = "Hello World";
print "Content-Type: text/html\n"; 
print "Content-Length: " . length($body) . "\n"; 
print "\n"; 

print $body . "\n";
exit 0;