Fixed the proxy checker deadlocking once the queue empties - #6625
Open
dekrom wants to merge 1 commit into
Open
Conversation
crosby-moe
approved these changes
Aug 30, 2026
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.
Type of change
Description
Proxies#checkis a check then act race:Every worker runs that loop against the same
ArrayBlockingQueue. As the queue drains, severalof them can pass
isEmpty()and then all calltake(). One gets the last proxy, the rest blockforever, because nothing is ever added again once the work is done.
awaitTermination(Long.MAX_VALUE, ...)then never returns,refreshing = falseis neverreached, and the try-with-resources
close()blocks on top of that. So one refresh with thedefault 8 threads parks up to 7 pool threads plus the MeteorExecutor thread for the rest of the
session, and because
refreshingis stuck true bothcheckProxiesandcleansilently returnearly from then on. The proxy screen just stops responding to refresh until you restart the
game.
poll()fixes the race without any extra bookkeeping: a worker only exits when it sees an emptyqueue, and a worker that requeues a proxy for a retry goes straight back to
poll(), so nothingis left behind when the last one exits.
offer()replacesput()for the same reason, and thequeue is sized to hold every proxy so it cannot reject.
Two smaller things in the same path:
refreshing = falsemoved into afinally, so a throw anywhere in the block cannot wedge theflag again.
threadshad.min(0), andExecutors.newFixedThreadPool(0)throwsIllegalArgumentException. Setting the slider to 0 wedgedrefreshingimmediately, in thesame way. Minimum is now 1.
Related issues
None that I found.
How Has This Been Tested?
Reasoned out of the source rather than caught live, so I have not sat and watched a refresh hang
yet. The race is plain in
check()and the stuckrefreshingflag follows from it. Builds cleanagainst current master.
Checklist: