fix: the repl thread may join itself when the server is stopped
ref: #2806
Hi @git-hulk , can you review the pr if you have free time?
@fukua95 sure, thank you.
I'm wondering if it's possible to add a test case for this?
I test it, but I can't reproduce the bug.
In a multi-thread process, every thread have the chance to be interrupted by derive. When the repl thread be interrupted, it will implement the signal handle function, and the handle function will join the repl thread, which cause deadlock.
I20250226 11:50:45.351392 140030983013952 main.cc:50] Signal Terminated (15) received, stopping the server
W20250226 11:50:45.351526 140030983013952 replication.cc:371] Replication thread operation failed: thread #140030983013952 cannot be `join`ed: Resource deadlock avoided
I20250226 11:50:45.351537 140030983013952 replication.cc:373] [replication] Stopped
From the log, we know the xxx3952 is the repl thread ID, and it received the signal -> call Server::Stop() -> wants to join itself (xxx3952).
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code