fix: SaslServer busy-loop causes process hang after test suite#3305
Open
kevinjqliu wants to merge 1 commit intoapache:mainfrom
Open
fix: SaslServer busy-loop causes process hang after test suite#3305kevinjqliu wants to merge 1 commit intoapache:mainfrom
kevinjqliu wants to merge 1 commit intoapache:mainfrom
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
Author
|
not sure if im tripping, but this took me a while to figure out, and only affects python 3.13 |
rambleraptor
approved these changes
May 1, 2026
Contributor
rambleraptor
left a comment
There was a problem hiding this comment.
This looks sensible. What a find! Thanks for doing this
| except Exception: | ||
| pass | ||
| self._socket.close() | ||
| self.join(timeout=5) |
Contributor
There was a problem hiding this comment.
I have the feeling I know the answer, but why 5?
| self._socket.close() | ||
| self.join(timeout=5) | ||
| for client in self._clients: | ||
| client.close() |
Contributor
There was a problem hiding this comment.
This should probably be in a try/except block again. If one of these throws an exception, it'll crash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
PYTHON=3.13 make testhangs after all tests pass.The
SaslServertest helper hasexcept Exception: passin its accept loop. Afterclose()is called,accept()raises on every iteration but the exception is swallowed, creating a tight busy-loop that holds the GIL and prevents the process from exiting.This is particularly severe on CPython 3.13+ on macOS, where GIL fairness changes make the main thread unable to make progress against the spinning daemon thread.
Changes
except Exception: pass->except Exception: breakto exit the loop when the socket is closedclose(): close the server socket first (unblocksaccept()), thenjoin()the thread (ensures no more client appends), then close tracked clientsAre these changes tested?
PYTHON=3.13 make testpasses with clean exit.Are there any user-facing changes?
No.