简体   繁体   English

net::ERR_INCOMPLETE_CHUNKED_ENCODING 仅在 Chrome 中

[英]net::ERR_INCOMPLETE_CHUNKED_ENCODING in Chrome only

I've been getting this error when loading certain pages:加载某些页面时出现此错误:

net::ERR_INCOMPLETE_CHUNKED_ENCODING 

These pages don't do anything special and everything seems to work in other browsers.这些页面没有做任何特别的事情,而且一切似乎都可以在其他浏览器中运行。 The pages that this happens on display data in JSON.发生这种情况的页面以 JSON 格式显示数据。 It only happens when the JSON page has to display a large amount of items.只有当 JSON 页面必须显示大量项目时才会发生这种情况。 The rails console is not displaying any errors (200 response). rails 控制台未显示任何错误(200 响应)。

I have met this problem yesterday. 我昨天遇到了这个问题。 It's because of the server didn't response some resources. 这是因为服务器没有响应一些资源。

In my page, i have some large file links like <a href="/file_path">file_name</a> , and this happend only in chrome. 在我的页面中,我有一些大的文件链接,如<a href="/file_path">file_name</a> ,这只发生在chrome中。

In a while ,I recognized this maybe caused by the chrome's 'Predict network actions to improve page load performance' feature.So I turned off this feature in chrome://settings and try it again. 有一段时间,我认识到这可能是由Chrome的'预测网络操作提高页面加载性能'功能引起的。所以我在chrome://settings关闭了这个功能并再次尝试。 As expected, the error didn't occur again. 正如所料,错误没有再次发生。

After that, I changed resource links with full_url_path instead of relative_path(in rails, use resource_url instead of resource_path), then I didn't have to turn off the chrome's feature. 之后,我用full_url_path而不是relative_path更改了资源链接(在rails中,使用resource_url而不是resource_path),然后我不必关闭chrome的功能。 And it looks good. 它看起来不错。

In my case, the problem was cache-related and was happening when doing a CORS request. 就我而言,问题与缓存有关,并且在执行CORS请求时发生了。

As stated in comments above: 如上面的评论中所述:

the error seemed to appear randomly 错误似乎随机出现

This is because of the Http cache system. 这是因为Http缓存系统。

Forcing the response header Cache-Control to no-cache resolved my issue: 强制响应头Cache-Control no-cache解决了我的问题:

[ using Symfony HttpFoundation component ] [使用Symfony HttpFoundation组件]

<?php
$response->headers->add(array(
   'Cache-Control' => 'no-cache'
));

I had this with a Wordpress website, also only in Chrome. 我有一个Wordpress网站,也只有Chrome。

Updating the website and its plugins to the latest version didn't help, and other people didn't seem to have the same problem when visiting the website, but then I saw this post , turned off my antivirus (avast) real-time shields , as suggested, and the problem went away. 将网站及其插件更新到最新版本没有帮助,其他人在访问网站时似乎没有同样的问题,但后来我看到这篇帖子关闭了我的防病毒(avast)实时防护正如所建议的那样,问题就消失了。

NOTE: The Real-Time Protection on some of the various anti-virus programs (AVAST, Kapersky and ESET) seem to be a major cause of this error. 注意:某些反病毒程序(AVAST,Kapersky和ESET)的实时保护似乎是导致此错误的主要原因。

I had this in a symfony project (PHP). 我在symfony项目(PHP)中有这个。

Like you describe your issue I had some static page (html.twig) with simple HTML and CSS... so nothing special about it. 就像你描述你的问题一样,我有一些带有简单HTML和CSS的静态页面(html.twig)...所以没什么特别的。

For me it was a mod_rewrite problem, after I enabled mod_rewrite and added FallbackResource /index.php to my vhost it all worked smoothly. 对我来说这是一个mod_rewrite问题,在我启用mod_rewrite并将FallbackResource /index.php添加到我的vhost之后它一切顺利。

PS: if you have apache lower than 2.2.16 create a .htaccess file in your root folder and use this code: PS:如果您的apache低于2.2.16,请在根文件夹中创建.htaccess文件并使用以下代码:

Options -MultiViews 选项-MultiViews

 RewriteEngine On #RewriteBase /path/to/app RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] </IfModule> 

We had net::ERR_INCOMPLETE_CHUNKED_ENCODING problem in case of HTML, which contained too much empty lines. 在HTML的情况下,我们有net::ERR_INCOMPLETE_CHUNKED_ENCODING问题,其中包含太多空行。 Some browsers had difficulties with interpretation of long files. 有些浏览器难以解释长文件。

Once we've made code cleaning in our templates by cleaning the code from empty lines, error disappeared. 一旦我们通过清空空行代码在模板中进行代码清理,错误就消失了。

This error comes, if you have relationship among domain objects or model object which you are returning back to Jquery. 如果您要返回到Jquery的域对象或模型对象之间存在关系,则会出现此错误。 Please annotate with @JsonBackReference, your issue will be resolved 请使用@JsonBackReference进行注释,您的问题将得到解决

@ManyToOne(fetch = FetchType.LAZY,cascade=CascadeType.ALL)
@JoinColumn(name = "parentId", nullable = false)
@JsonBackReference
public Parent getParent() {
    return this.parent;
}

@OneToMany(cascade=CascadeType.ALLfetch =FetchType.LAZY,mappedBy=      
"parent")
@JsonBackReference
public Set<Category> getChild() {
   return this.child;
}

At least for Java Web Application, and more specifically using JSPs, I have seen this happening when JSP are messed up. 至少对于Java Web应用程序,更具体地说是使用JSP,我已经看到当JSP被搞砸时会发生这种情况。 So, make sure your JSPs are correct. 因此,请确保您的JSP正确无误。

Please check your radware load balancer configuration. 请检查您的radware负载平衡器配置。 The setting for “FastView” and “APM” features can cause this issue. “FastView”和“APM”功能的设置可能会导致此问题。 In my case it will get fixed after disabling those. 在我的情况下,它将在禁用它们后得到修复。

If you have opened any streams for the response those must be closed. 如果您已为响应打开任何流,则必须关闭这些流。 For example code if you have opened a ServletOutputStream to download the zip directory the stream need to be closed as follows. 例如,如果您打开了ServletOutputStream来下载zip目录,则需要关闭该流,如下所示。

ServletOutputStream sos = response.getOutputStream();
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "attachment;filename=project.ZIP");
sos.write(zip);
sos.flush();
sos.close();

I've catched the same error on a local website. 我在本地网站上遇到了同样的错误。 In logs I found this record: 在日志中我找到了这条记录:

"nginx failed (13: Permission denied) while reading upstream, client:   127.0.0.1".

My decision through restart of nginx and php-fpm from the right user: 我决定通过从正确的用户重启nginx和php-fpm:

Let's my_user – main user of website's directory. 我们是my_user - 网站目录的主要用户。

First, go to nginx.conf: Change 首先,转到nginx.conf:更改

user nginx; -> user my_user my_user_group;

or paste this 或者粘贴这个

user my_user my_user_group;

on the top of file 在文件的顶部

2) Second, in php5/fpm/pool.d/www.conf 2)其次,在php5 / fpm / pool.d / www.conf中

# Find and change this variables from old -> to new:
user -> my_user
group -> my_user
listen.owner -> my_user
listen.group -> my_user

3) And finally you need restart of nginx and php-fpm. 3)最后你需要重启nginx和php-fpm。 Then make chown 0700 in handmode for /var/lib/nginx/tmp for my_user, like this: 然后在hand_ode中为/ var / lib / nginx / tmp为my_user制作chown 0700,如下所示:

chown -R my_user:my_user 0700 /var/lib/nginx/tmp

In my case I have "No space left on device". 在我的情况下,我有“设备上没有剩余空间”。 When I delete useless files on Server — error disappeared 当我在服务器上删除无用文件时 - 错误消失了

If having problems with symfony4 apache2 , take a look at this answer 如果遇到symfony4 apache2的问题, 请看一下这个答案

as summary, you have to disable FallbackResource/index.php into your virtualhost configuration file, next, you may want to run composer install symfony/apache-bundle and fix your /etc/apache2/apache.conf changing AllowOverride none for AllowOverride All , in order to enable the .htaccess file created in the installation recipe run, at the end, by restarting apache2 service ( sudo service apache2 restart ) the site must load without /index.php at the end of the URI. 总结一下,您必须将FallbackResource/index.php禁用到您的virtualhost配置文件中,接下来,您可能需要运行composer install symfony/apache-bundle并修复/etc/apache2/apache.conf更改AllowOverride none for AllowOverride All ,为了启用在安装配方中创建的.htaccess文件,最后,通过重新启动apache2服务( sudo service apache2 restart ),站点必须在URI末尾加载而不加入/index.php。

Hope this helps someone! 希望这有助于某人!

根据我的经验,有一个异常会停止正常的代码执行,返回不完整或意外的结果围绕 try/catch 中的所有代码 [具有最高异常级别(例如 java 中的“可抛出”)] 并记录异常 另一种方法是使用调试器异常断点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM