Skip to content

bug: 网关异常 #219

@q343959872

Description

@q343959872

Current Behavior

stream write error: connection closed以及process quit error: os: process already finished 错误

导致网关一段时间处于不可用状态,

Expected Behavior

No response

Error Logs

[2025-04-24 09:25:56] [ERRO] [worker-13993]stream write error: connection closed
[2025-04-24 09:26:18] [ERRO] [worker-13993]stream write error: connection closed
[2025-04-24 09:27:06] [ERRO] [worker-13993]stream write error: connection closed
[2025-04-24 10:15:03] [ERRO] [worker-13993]stream write error: connection closed
[2025-04-24 10:37:07] [ERRO] [worker-13993]stream write error: connection closed
[2025-04-24 10:47:15] [ERRO] [worker-13993]stream read error: empty hex number
[2025-04-24 10:47:15] [ERRO] [worker-13993]stream read error: empty hex number
[2025-04-24 10:47:15] [ERRO] [worker-13993]stream read error: empty hex number
panic: runtime error: slice bounds out of range [:4097] with capacity 4096

goroutine 4882 [running]:
bufio.(*Reader).Peek(0xc001402660, 0x1)
/opt/hostedtoolcache/go/1.21.1/x64/src/bufio/bufio.go:168 +0x16a
github.com/valyala/fasthttp.(*ResponseHeader).tryRead(0xc000cb4a80, 0xc000be44e8
?, 0x1)

/home/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.47.0/header.go:1985 +
0x4c
github.com/valyala/fasthttp.(*ResponseHeader).Read(
0xc000cb4a80?,
0xc001402660)
/home/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.47.0/header.go
:1971 +0x3d
github.com/valyala/fasthttp.(*Response).ReadLimitBody(0xc000cb4a80, 0x2df37f8?, 0xc000dbb890?)
/home/runner/go/pkg/mod/github.com/valyala/fasthttp@v1.47.0/http.go
:1391 +0x38

github.com/valyala/fasthttp.(*HostClient).doNonNilReqResp(
0xc000a8c000, 0xc000ad2600
, 0xc000cb4a80
)

详情可见附件

Steps to Reproduce

  1. 正常请求(可能存在一个附件下载接口)
  2. 客户端响应收到502异常
  3. nginx日志有如下信息
    2025/04/24 10:57:16 [error] 32613#0: *85049162 no live upstreams while connecting to upstream, client: 10.20.20.50, server: xxx, request: "POST /ai/tts HTTP/1.1", upstream: "http://gateway_server/ai/tts", host: "xxx"

2025/04/24 10:57:20 [error] 32607#0: *85048752 upstream prematurely closed connection while reading response header from upstream, client: 10.20.20.50, server: xxx, request: "POST /redapi/st/pfconfig/bffPhone/entrance HTTP/1.1", upstream: "http://xxx/redapi/st/pfconfig/bffPhone/entrance", host: "xxx"

Environment

  • APINTO version (run apinto version): 0.21.2
  • Linux redgpts04 3.10.0-1160.el7.x86_64 init #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

error.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions