闹心的Broken pipe

作者: 小尘哥 | 来源:发表于2018-09-05 14:15 被阅读7次

林子大了什么鸟都有,程序猿做久了什么bug都有。

bug描述

  1. 出现在excel导入的时候
  2. 线上有问题,本地不可重现
  3. 数据量少的时候没问题,excel基本超过1500行就出现问题
  4. 查看日志
错误日志.png

解决

  1. 看日志,应该是失去客户端连接。猜测应该是导入操作的http请求超时。
  2. 在导入方法添加日志,发现后台导入逻辑还在执行时候ajax已经返回超时了。猜测导入操作的ajax时长设置有问题。
  3. 查看代码,导入操作$.ajax({})提交,设置timeout:0,测试,依然超时。后台使用springboot+easypoi,猜测springboot有设置http超时时长。
  4. 修改springboot配置server.connection-timeout=120000为两分钟,测试,依然超时,但是发现一个有趣的地方,每次都是到1分钟时候超时,因此问题肯定不在以上两个地方
  5. 全局搜60、1min等无果
  6. 再对比本地和线上环境,本地IDE运行,线上多个服务通过fegin相互调用,最终通过nginx代理到外网,对,nginx代理
  7. 修改nginx配置如下,问题解决
    location /guanli {
            root           html;
            index          index.html index.htm;
            proxy_set_header Host $host;
            proxy_set_header X-Real-Ip $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
        proxy_send_timeout 1200s;
          # nginx接收upstream server数据超时, 默认60s, 如果连续的60s内没有收到1个字节, 连接关闭
        proxy_read_timeout 1200s;
          # nginx与upstream server的连接超时时间
        proxy_connect_timeout 1200s;
          # 发送数据至客户端超时, 默认60s, 如果连续的60s内客户端没有收到1个字节, 连接关闭
        send_timeout 1200s;
            proxy_pass     http://adminService;
        }

ps:

  1. 可能有童鞋提出导入时间太长,这个也作为优化的一个角度,可是数据再多的时候,也可能2分钟都不够~~~
  2. nginx配置中文网

相关文章

  • 闹心的Broken pipe

    林子大了什么鸟都有,程序猿做久了什么bug都有。 bug描述 出现在excel导入的时候 线上有问题,本地不可重现...

  • Broken pipe 与 Hibernate

    broken pipe 导致broken pipe的原因有很多,不过其根本原因都是:当往socket管道写入数据的...

  • UEditor导致的上传大文件失败

    之前写过一篇 《闹心的Broken pipe》,nginx导致的请求超时,但是今天又碰到个奇葩事儿,容我喝一口82...

  • charles map local socket broken

    fix the "charles map local socket broken pipe (write fail...

  • dart: socket error错误一览

    SocketException: OS Error: Broken pipe, errno = 32 这个错误其实...

  • Broken pipe 问题

    结论 915投产演练时,因服务器刀容存在问题,引起了网络抖动,致使响应时间超长,耗尽了渠道接入数量,积累大量请求得...

  • pipe broken问题

    $ ssh -o ServerAliveInterval=60 user@sshserver让当前ssh永远保持链接

  • ssh

    ssh--write failed broken pipe 转自newinstance I started to ...

  • ssh出现broken pipe

    因为修改一些东西,出现broken pipe 只需 找到对应服务器ip所在行,删除

  • writeFully: failed: Broken pipe

    writeFully: failed: Broken pipe exit(-100)一般是用模拟器运行a...

网友评论

    本文标题:闹心的Broken pipe

    本文链接:https://www.haomeiwen.com/subject/bedawftx.html