Skip to content
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

Fix connection reaper deadlock. #150

Merged
merged 6 commits into from
Jan 24, 2024
Merged

Fix connection reaper deadlock. #150

merged 6 commits into from
Jan 24, 2024

Conversation

egorse
Copy link
Contributor

@egorse egorse commented Jan 10, 2024

Added explicitly running test to detect deadlock.
Use go test -tags=TestConnReaperDeadlockLoop -run ^TestConnReaperDeadlockLoop$. Be aware the test generate a lot of sockets in TIME_WAIT. Without patch to socket.go it breaks pretty quick on fast and slow machines. With the patch it runs up to default test timeout (10m) but gets slower when there are plenty of sockets in TIME_WAIT.

Fixes #149

Sergey Egorov added 2 commits January 10, 2024 11:27
Added explicitly running test to detect deadlock.
Use ```go test -tags=TestConnReaperDeadlockLoop -run ^TestConnReaperDeadlockLoop$```.
Be aware the test generate a lot of sockets in TIME_WAIT.
Without patch to socket.go it breaks pretty quick on fast and slow machines.
With the patch it runs way longer but gets slower when there are plenty of sockets in TIME_WAIT.
@egorse
Copy link
Contributor Author

egorse commented Jan 11, 2024

Dont get whats wrong with TestXPubSub - I ran it only in loop for almost 24h - no single failure

Copy link
Contributor

@sbinet sbinet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies for the belated answer (coming back from holidays)

just a couple of nitpicks.

socket.go Outdated Show resolved Hide resolved
socket.go Outdated Show resolved Hide resolved
socket_loop_test.go Outdated Show resolved Hide resolved
socket_loop_test.go Outdated Show resolved Hide resolved
Co-authored-by: Sebastien Binet <binet@cern.ch>
@egorse
Copy link
Contributor Author

egorse commented Jan 16, 2024

I will try to find way to make test with single pass to hit the deadlock. Please give me couple of days

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (16ca7c0) 68.19% compared to head (66d39ee) 68.22%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
+ Coverage   68.19%   68.22%   +0.03%     
==========================================
  Files          30       30              
  Lines        2600     2603       +3     
==========================================
+ Hits         1773     1776       +3     
  Misses        724      724              
  Partials      103      103              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The test TestConnReaperDeadlock2 designed after TestConnReaperDeadlock
but uses internals to ensure problematic sequnence, which in
case of TestConnReaperDeadlock requires number of runs.
@egorse
Copy link
Contributor Author

egorse commented Jan 21, 2024

I think the test is now ready but it might looks more ugly even can repro problem each run.
Please comment

Copy link
Contributor

@sbinet sbinet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for sticking with us.
I have a couple of comments (mostly cosmetic, though)

reaper_test.go Outdated Show resolved Hide resolved
reaper_test.go Outdated Show resolved Hide resolved
reaper_test.go Outdated Show resolved Hide resolved
Additional test simplification.
Now it needs only two connections,
where 1st fails asap
and 2nd fails with delay - giving connection reaper time to meet deadlock
Copy link
Contributor

@sbinet sbinet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

thanks for sticking through the iterative refinement process :)

@sbinet sbinet merged commit e75c615 into go-zeromq:main Jan 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deadlock detected by TestConnReaperDeadlock
2 participants