Skip to content

fix: guard connCloser with a mutex to avoid a data race on cancel - #313

Closed
csiwek wants to merge 1 commit into
emiago:mainfrom
csiwek:main
Closed

fix: guard connCloser with a mutex to avoid a data race on cancel#313
csiwek wants to merge 1 commit into
emiago:mainfrom
csiwek:main

Conversation

@csiwek

@csiwek csiwek commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Synchronize connCloser access in ListenAndServe

Without this, -race detector flags causes data races on cancel.
It will probably never happens when running single ListenAndServe but it is possible when you have multiple sockets open.

Also needed if you just test code that uses sipgo with -race flag

@csiwek

csiwek commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

I don't think the failing test is related to the PR

@emiago

emiago commented Jul 18, 2026

Copy link
Copy Markdown
Owner

@csiwek added better fix. Check main if it works.

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.

2 participants