大型文件耗时超过一分钟时,net :: ERR_CONNECTION_RESET [英] net::ERR_CONNECTION_RESET when large file takes longer than a minute

查看:293
本文介绍了大型文件耗时超过一分钟时,net :: ERR_CONNECTION_RESET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以带有php后端的形式上传了多部分文件.我已将php.ini中的max_execution_timemax_input_time设置为180,并在文件上传中确认设置了这些值,并在Apache中将TimeOut设置为180.我还设置了

I have a multipart file upload in a form with a php backend. I've set max_execution_time and max_input_time in php.ini to 180 and confirmed on the file upload that these values are set and set TimeOut 180 in Apache. I've also set

RewriteRule .* - [E=noabort:1]
RewriteRule .* - [E=noconntimeout:1]

当我通过快速连接上传250MB文件时,它可以正常工作.当我使用较慢的连接或人为地降低其速度的网络链接调节器时,同一文件会超时,并且在Chrome上可靠地在1分钟(和5秒)后显示net::ERR_CONNECTION_RESET.我还尝试了其他具有相同结果,只是错误消息不同的浏览器.

When I upload a 250MB file on a fast connection it works fine. When I'm on a slower connection or a network link conditioner to artificially slow it down, the same file times out and on Chrome gives me net::ERR_CONNECTION_RESET after 1 minute (and 5 seconds) reliably. I've also tried other browsers with the same outcome, just different error messages.

在任何日志中都没有错误指示,我已经在httphttps上都尝试过.

There is no indication to an error in any log and I've tried both on http and https.

什么会导致1分钟后重置上载连接?

What would cause the upload connection to be reset after 1 minute?

编辑

我现在还尝试了一种简单的上传表单,该表单可以绕过我正在使用的任何框架,但仍然会在1分钟后超时.

I've now also tried to have a simple upload form that bypasses any framework I'm using, still timeouts at 1 minute.

我还刚刚制作了一个睡眠脚本,该脚本在2分半钟后超时,并且可以正常工作,页面加载大约需要2.5分钟,因此我看不到它与浏览器或标头的相关性.

I've also just made a sleep script that timeouts after 2 and a half minutes, and that works, page takes around 2.5 minutes to load so I can't see how it's browser or header related.

我还使用了具有更多RAM的服务器,以确保它与此无关.我已经在具有不同规格的3台不同服务器上进行了测试,但所有服务器均来自同一CentOS 7.

I've also used a server with more RAM to ensure it's not related to that. I've tested on 3 different servers with different specs but all from the same CentOS 7 base.

我现在还升级到PHP 7.2,并再次更新了相关字段,而问题没有任何改变.

I've now also upgraded to PHP 7.2 and updated the relevant fields again with no change in the problem.

编辑2 此孤立实例的技术堆栈为

EDIT 2 The tech stack for this isolated instance is

  • Apache 2.4.6
  • PHP 5.6/7.2(都尝试过),具有OPCache
  • Redis 3.2.6用于会话信息和键/值存储(ElastiCache)
  • PostgreSQL 10.2(RDS)

我的技术堆栈中的所有其他内容都已从该测试区域中删除,以尝试找出问题所在. EFS在系统上,但是在我最孤立的测试中,它只是在使用EBS.

Everything else in my tech stack has been removed from this test area to try and isolate the problem. EFS is on the system but in my most isolated test it's just using EBS.

编辑3 这里是chrome网络调试器的一些日志:

EDIT 3 Here some logs from the chrome network debugger:

{"params":{"net_error":-101,"os_error":32},"phase":0,"source":    {"id":274043,"type":8},"time":"3332701830","type":69},
{"params":    {"error_lib":33,"error_reason":101,"file":"../../net/socket/socket_bio_adapter.cc","line":216,"net_error":-101,"ssl_error":1},"phase":0,"source":        {"id":274043,"type":8},"time":"3332701830","type":56},
{"phase":2,"source":{"id":274038,"type":1},"time":"3332701830","type":159},
{"phase":1,"source":    {"id":274038,"type":1},"time":"3332701830","type":164},
{"phase":1,"source":    {"id":274038,"type":1},"time":"3332701830","type":287},
{"params":    {"error_lib":33,"error_reason":101,"file":"../../net/socket/socket_bio_adapter.cc","line":113,"net_error":-101,"ssl_error":1},"phase":0,"source":    {"id":274043,"type":8},"time":"3332701830","type":55},
{"params":{"net_error":-101},"phase":2,"source":    {"id":274038,"type":1},"time":"3332701830","type":287},
{"params":{"net_error":-101},"phase":2,"source":{"id":274038,"type":1},"time":"3332701830","type":164},
{"params":{"net_error":-101},"phase":2,"source":{"id":274038,"type":1},"time":"3332701830","type":97},
{"phase":1,"source":{"id":274038,"type":1},"time":"3332701830","type":105},
{"phase":2,"source":{"id":274038,"type":1},"time":"3332701830","type":105},
{"phase":2,"source":{"id":274043,"type":8},"time":"3332701830","type":38},
{"phase":2,"source":{"id":274043,"type":8},"time":"3332701830","type":38},
{"phase":2,"source":{"id":274043,"type":8},"time":"3332701830","type":34},
{"params":{"net_error":-101},"phase":2,"source":{"id":274038,"type":1},"time":"3332701830","type":2},

推荐答案

我遇到了类似的问题,在我的案例中,该问题与 mod_reqtimeout 有关,添加了以下内容:

I went through a similar problem, in my case it was related to mod_reqtimeout by adding:

RequestReadTimeout header=20-40, MinRate=500 body=20, MinRate=500

达到了httpd.conf的目的! 您可以在此处中查看文档.

to httpd.conf did the trick! You can check the documentation here.

希望有帮助!

这篇关于大型文件耗时超过一分钟时,net :: ERR_CONNECTION_RESET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆