apache / apache/brpc

v1.2报错Segmentation fault

Open
#3,264 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
17.6k
Forks
4.1k
Avg merge
2d 12h
Merged PRs (30d)
69

Description

对应socket.cpp 1068-1082代码: // Someone added new requests.
// Reverse the list until old_head.
WriteRequest* tail = NULL;
WriteRequest* p = new_head;
do {
while (p->next == WriteRequest::UNCONNECTED) {
// TODO(gejun): elaborate this
sched_yield();
}
WriteRequest* const saved_next = p->next;
p->next = tail;
tail = p;
p = saved_next;
CHECK(p != NULL);
} while (p != old_head);
二进制程序依赖了mrpc,执行压测时候报错:received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xf9fd3efdeb80 (LWP 76473)] brpc::Socket::IsWriteComplete (this=0xf9fd00025450, this@entry=0x0, old_head=, singular_node=, new_tail=new_tail@entry=0xf9fd3cc2bf68) at brpc/socket.cpp:1073 1073 brpc/socket.cpp: No such file or directory. (gdb) bt full #0 brpc::Socket::IsWriteComplete (this=0xf9fd00025450, this@entry=0x0, old_head=, singular_node=, new_tail=new_tail@entry=0xf9fd3cc2bf68) at brpc/socket.cpp:1073 saved_next = new_head = 0x0 desired = return_when_no_more = tail = 0x0 p = 0x0 #1 0x00000000009c6200 in brpc::Socket::KeepWrite (void_arg=) at brpc/socket.cpp:1673

Contributor guide

Open the contributing guide

Research direction

Start with the reported path in socket.cpp, especially IsWriteComplete around lines 1068-1082 and KeepWrite around line 1673. Reproduce the SIGSEGV during a stress test and inspect how new_head and p become null before the loop dereferences p->next. Done means identifying and correcting the crash condition and confirming the binary no longer fails under the reported load.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.