Fix stale remote server picker responses overwriting newer ones - #367
Open
coderandhiker wants to merge 1 commit into
Open
coderandhiker wants to merge 1 commit into
coderandhiker wants to merge 1 commit into
Conversation
restartPicker is debounced, but a StartPicker call already in flight is not cancelled when the base path changes again. Typing the host before the port starts a picker for the default port; if that attempt is still failing when the real port is entered, its error lands after the newer picker succeeded and replaces the working state with a stale "failed to connect" error. Had the stale attempt succeeded instead, it would have replaced pickerId with a picker for the wrong url and leaked the newer one. Capture the base path before awaiting, and discard the response (releasing the picker it created) if the base path changed or the picker was disabled in the meantime, the same way checkValid already discards stale TryPick responses.
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.
restartPicker is debounced, but a StartPicker call already in flight is not cancelled when the base path changes again. Typing the host before the port starts a picker for the default port; if that attempt is still failing when the real port is entered, its error lands after the newer picker succeeded and replaces the working state with a stale "failed to connect" error.
Capture the base path before awaiting, and discard the response (releasing the picker it created) if the base path changed or the picker was disabled in the meantime, the same way checkValid already discards stale TryPick responses.
In the error message shown, my IP followed by port 22 was shown, I had typed a different port number.
I encountered this issue while working on satisfactorymodding/ficsit-cli#86, which refs #304