Fix insufficient resources error handling - #819
Open
ZihaoFU245 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
The triggering can be done by open many TCP connections to the socks listener. keep the connections open/stall, each conenciton will let naive consume a discriptor, naive reaches fd max, accept returns insufficient resoruces, naive is trapped. |
klzgrad
reviewed
Jul 21, 2026
When naive DoAccept failed on ERR_INSUFFICIENT_RESOURCES, rv is passed to DoAcceptComplete, if rv is not OK, this function sets next state to DoAccept again, when naive reaches system wide file discriptor limits, and a pending CONNECT in queue, naive will be trapped in an infinite busy spinning loop and can not recover as resources are not reclaimed.
ZihaoFU245
force-pushed
the
fix-resource-exhaust
branch
from
July 21, 2026 18:01
70b8646 to
e6d6e19
Compare
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.
When naive DoAccept failed on ERR_INSUFFICIENT_RESOURCES, rv is passed to DoAcceptComplete, if rv is not OK, this function sets next state to DoAccept again, when naive reaches system wide file discriptor limits, and a pending CONNECT in queue, naive will be trapped in an infinite busy spinning loop and can not recover as resources are not reclaimed.
Trigger requirements:
The patch schedules a 1 second retry, and returns ERR_IO_PENDING to exit DoLoop from busy spinning, and calls OnIOComplete to reclaim resources, so naive can recover from this trap.
This issue is founded when testing naive with #818 , DNS on UDP can consume resources very quickly, and would trigger this issue. Though on CONNECT (TCP) this case is very rare it could happen.