-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes the asynchttpserver example some more #16599
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to wait until a FD is closed to avoid a forced wait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the ideal indeed. There is no way to do this out of the box, you could potentially get a good approximation if you add some code into each
close
proc that would then complete aFuture
to let code awaiting that future know that the FDs have been freed. But that assumes all your FDs are created within Nim, if you call into C you're screwed.More and more, I'm having a hard time keeping an open mind to this "improvement". I'm curious whether other languages implement something similar. I've never seen somebody work around FD limits like this so this really smells like a bad idea to me still, especially now that it's needing so many fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this PR has already been merged but I figured I'd share my opinion (two cents) regardless.
IMO, the real pitfall here is trying to cope with too few FDs silently. If a system runs of out FDs (or any resource for that matter), it should somehow tell the administrator that it's operating beyond its capabilities and is no longer able to fulfill requests. (i.e. a simple log statement would help)
It's great that we're making httpserver more resilient, but in almost all occurrences this is still an undesirable situation and so should probably be communicated.
EDIT: Ooops I didn't realize this change was for the
runnableExamples
section, but still my comment applies to theserve()
proc declared inasynchttpserver.nim
, which still uses thepoll()
method. It seems these two should be consistent and include some logging for the out-of-FD situation. If it helps, LMK if you'd like me to submit a PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're interested in making a PR then I would encourage you to implement what I described below (#16599 (comment)). That is unless you disagree with it. Personally I don't think we should expose this mechanism in the way that we do at all. Asynchttpserver should just call
accept
and handle the errors it receives appropriately, and yes it should log when that happens.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential solution: timotheecour#750