gatewayWorker中的错误

rbb

问题描述

使用gatewayWorker开发的websocket服务,在宝塔环境下,配置nginx代理后,nginx偶尔会报

错误1:
[error] 1511926#0: *51138 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:xxxx

错误2:
[error] 3219339#0: *10411652 send() failed (32: Broken pipe) while proxying upgraded connection, client: 117.136.62.231

程序代码

nginx的配置:
location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      if (!-f $request_filename){
          proxy_pass http://127.0.0.1:7273;
      }
    }

报错信息

错误1:
[error] 1511926#0: *51138 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:xxxx

错误2:
[error] 3219339#0: *10411652 send() failed (32: Broken pipe) while proxying upgraded connection, client: 117.136.62.231

操作系统及workerman/webman等框架组件具体版本

"workerman/gateway-worker": "^3.0",

Nginx 1.22.1

127 1 0
1个回答

walkor

reload,restart 会导致这样的报错,可以忽略

  • rbb 2024-03-05

    我基本上没有reload和restart过,一直在运行,除非要发布的时候。几天没有你说的这2个操作,依旧会报错

  • walkor 2024-03-05

    看下workerman.log日志

  • walkor 2024-03-05

    错误一天多少条?

  • rbb 2024-03-05

    一天零星1-4条吧,同时在线有个500+。

    日志:2024-01-31 17:00:21 pid:1656330 Workerman[start.php] has been stopped
    2024-01-31 17:00:21 pid:1713163 Workerman[start.php] stop success
    2024-01-31 17:00:24 pid:1713307 Workerman[start.php] start in DAEMON mode
    2024-01-31 17:00:35 pid:1713828 Workerman[start.php] status
    2024-01-31 17:18:54 pid:1762820 Workerman[start.php] status
    2024-01-31 17:18:59 pid:1763041 Workerman[start.php] status
    2024-01-31 18:05:34 pid:1888235 Workerman[start.php] status
    2024-01-31 18:09:54 pid:1900842 Workerman[start.php] status
    2024-01-31 18:14:08 pid:1912516 Workerman[start.php] status
    2024-01-31 18:15:34 pid:1916401 Workerman[start.php] status
    2024-01-31 18:18:20 pid:1924105 Workerman[start.php] status
    2024-01-31 18:18:39 pid:1924712 Workerman[start.php] status
    2024-02-01 09:21:20 pid:3208460 Workerman[start.php] status
    2024-02-22 14:17:32 pid:3708738 Workerman[start.php] status

  • rbb 2024-03-05

    这都是最新的日志了

  • walkor 2024-03-05

    Broken pipe 那条应该是客户端与nginx交互的时候客户端关闭导致,和gatewayWorker没关系。
    Connection reset by peer 具体报错时间是?

  • walkor 2024-03-05

    还有websocket心跳间隔是?

  • rbb 2024-03-05

    心跳30S

    最新的:
    2024/03/02 23:33:47 [error] 3219339#0: 10246953 send() failed (32: Broken pipe) while proxying upgraded connection, client: 39.144.153.183,
    2024/03/03 21:49:22 [error] 3219339#0:
    10335155 send() failed (32: Broken pipe) while proxying upgraded connection, client: 39.144.249.17,
    2024/03/03 21:52:38 [error] 3219339#0: 10335557 send() failed (32: Broken pipe) while proxying upgraded connection, client: 39.144.249.17,
    2024/03/04 01:09:10 [error] 3219339#0:
    10363410 send() failed (32: Broken pipe) while proxying upgraded connection, client: 39.144.249.17,
    2024/03/04 10:33:29 [error] 3219339#0: 10411652 send() failed (32: Broken pipe) while proxying upgraded connection, client: 117.136.62.231,
    2024/03/05 01:49:38 [error] 3219339#0:
    10461341 send() failed (32: Broken pipe) while proxying upgraded connection, client: 39.144.228.100,

  • rbb 2024-03-05

    024/02/26 01:17:55 [error] 3219339#0: *9569074 send() failed (104: Connection reset by peer) while proxying upgraded connection, client: 221.222.21.192

    2024/03/02 12:12:59 [error] 3219339#0: *10177168 send() failed (104: Connection reset by peer) while proxying upgraded connection

  • rbb 2024-03-05

    php event扩展开了

  • walkor 2024-03-05

    看起来是浏览器和nginx之间的连接异常导致的,网络丢包什么的都可能出现,一天1-4条就不用管了,有重连就行

  • rbb 2024-03-05

    ok,我目测是客户端端了吧

🔝