Quality: OAuth callback listener thread and TCP port leak on timeout#733
Open
kumburovicbranko682-boop wants to merge 1 commit into
Conversation
When `listen_for_callback_parameter` times out via `rx.recv_timeout`, the function returns early with an error at step 4, skipping `handle.join()` at step 5. The spawned thread remains blocked on `listener.incoming()` (or on a slow `read_line`) indefinitely. Because the `TcpListener` is owned by the thread and never dropped, the port stays bound until the process exits. Any subsequent OAuth callback attempt that tries to bind the same port will fail with "address already in use", making the retry path dead. Affected files: oauth.rs Signed-off-by: kumburovicbranko682-boop <295886834+kumburovicbranko682-boop@users.noreply.github.com>
Collaborator
|
Looking now 👀 |
Collaborator
|
Please test your PR before submitting, this fails on. |
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.
Problem
When
listen_for_callback_parametertimes out viarx.recv_timeout, the function returns early with an error at step 4, skippinghandle.join()at step 5. The spawned thread remains blocked onlistener.incoming()(or on a slowread_line) indefinitely. Because theTcpListeneris owned by the thread and never dropped, the port stays bound until the process exits. Any subsequent OAuth callback attempt that tries to bind the same port will fail with "address already in use", making the retry path dead.Severity:
mediumFile:
psst-core/src/oauth.rsSolution
Store the listener handle and forcibly clean it up on timeout. The simplest fix is to make the thread joinable even in the error path:
Changes
psst-core/src/oauth.rs(modified)Testing