net::ERR_CONNECTION_RESET 当大文件需要超过一分钟时 [英] net::ERR_CONNECTION_RESET when large file takes longer than a minute

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

问题描述

我有一个带有 php 后端的表单上传的多部分文件.我已将 php.ini 中的 max_execution_timemax_input_time 设置为 180,并在文件上传时确认这些值已设置并将 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 上的 net::ERR_CONNECTION_RESET 在 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天全站免登陆