streaming模式,server发流,两个client收流,client报Connection reset by peer
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
**Describe the bug (描述bug)**
streaming模式下,server向client推流,message较大,每次StreamWrite 16M, 两个client同时发起echo调用,server同时向两个client推流,其中一个client会报错:
`I20230914 02:58:02.964776 24499 client.cpp:45] One message: size=16777216
I20230914 02:58:02.964805 24499 client.cpp:49] [144]Received from Stream=1: size = 16777216
I20230914 02:58:03.004117 24499 client.cpp:45] One message: size=16777216
I20230914 02:58:03.004145 24499 client.cpp:49] [145]Received from Stream=1: size = 16777216
W20230914 02:58:03.054648 24499 input_messenger.cpp:375] Fail to read from Socket{id=0 fd=3 addr=10.58.14.24:8001:41772} (0x563b04d4d1c0): Connection reset by peer [104]
I20230914 02:58:03.055034 24495 client.cpp:58] Stream=1 is closed`
server也会报错:
`I20230914 02:58:02.981964 31720 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216
I20230914 02:58:03.007588 31725 server.cpp:110] bthread=4294978049, send message to Stream=408, size=16777216
I20230914 02:58:03.016865 31689 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216
W20230914 02:58:03.054450 31714 input_messenger.cpp:375] Fail to read from Socket{id=306 fd=8 addr=10.58.14.28:41772:8001} (0x7fbe3c044dc0): Connection reset by peer [104]
W20230914 02:58:03.054462 31709 socket.cpp:1772] Fail to keep-write into Socket{id=306 fd=8 addr=10.58.14.28:41772:8001} (0x7fbe3c044dc0): Broken pipe [32]
I20230914 02:58:03.063979 31720 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216
I20230914 02:58:03.088527 31703 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216
I20230914 02:58:03.112658 31667 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216
I20230914 02:58:03.138048 31714 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216
W20230914 02:58:03.156893 31665 input_messenger.cpp:368] Socket{id=510 fd=9 addr=10.58.14.28:41848:8001} (0x7fbd60044dc0) was closed by remote side
I20230914 02:58:03.159297 31713 server.cpp:110] bthread=4294972162, send message to Stream=204, size=16777216`
**To Reproduce (复现方法)**
先启动server , 然后再同时启动两个client, 都是在容器中运行,server和client不在同一台机器,两个client在同一个机器不同的容器中
**Expected behavior (期望行为)**
两个client并发能像单个client一样,不出错。
**Versions (各种版本)**
OS: ubuntu:18.04 docker运行
Compiler: cmake 3.22.6 bazel 4.2.2
brpc: 1.6.0
protobuf: v3.19.1
**Additional context/screenshots (更多上下文/截图)**
错误信息:
server端:

client端:

Contributor guide
Research direction
Reproduce the issue with one server and two containerized clients, using concurrent streaming and 16 MiB StreamWrite calls. Start by tracing the reported failures in input_messenger.cpp and socket.cpp, alongside the client.cpp and server.cpp streaming logs. Done means both clients can receive the stream concurrently without connection resets or broken pipes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100