-
Notifications
You must be signed in to change notification settings - Fork 562
feat(replication): fix seg fault when ack is received after FeedSlaveThread::Stop is called #3101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: unstable
Are you sure you want to change the base?
Conversation
warn("Slave thread was terminated, would stop feeding the slave: {}", conn_->GetAddr()); | ||
} | ||
|
||
void FeedSlaveThread::Join() { | ||
if (auto s = util::ThreadJoin(t_); !s) { | ||
warn("Slave thread operation failed: {}", s.Msg()); | ||
} else { | ||
// after the loop is finished, the connection can be freed | ||
conn_.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not find where the connection is released after FeedSlaveThread
stops. Please let me know if this should not be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should be correct to reset the unique pointer only here. Because the connection has been detached from the worker before using it in FeedSlaveThread, so it's nothing to be done.
@@ -622,3 +625,126 @@ func TestSlaveLostMaster(t *testing.T) { | |||
duration := time.Since(start) | |||
require.Less(t, duration, time.Second*6) | |||
} | |||
|
|||
func TestWALDiscreteError(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to create a WAL with discrete sequence number to trigger the error, but I cannot trigger the seg fault. I think it is because the seg fault only happens when ack is sent back on the same connection after FeedSlaveThread::Stop
call and the time window is small.
I am leaving it here because it does no harm to test an extra case, but let me know if there is better way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm, this is not related to the seg fault
6c89761
to
2da98d2
Compare
2da98d2
to
95ecf41
Compare
fix: #3097