Skip to content
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

natalie-lang.org server.rb doesn't work with latest Natalie #2095

Open
seven1m opened this issue Jun 14, 2024 · 2 comments
Open

natalie-lang.org server.rb doesn't work with latest Natalie #2095

seven1m opened this issue Jun 14, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@seven1m
Copy link
Member

seven1m commented Jun 14, 2024

Starting in 2ef5771 the payload returned from https://natalie-lang.org/stats/stats.json is truncated. Need to investigate...

@seven1m seven1m added the bug Something isn't working label Jun 14, 2024
@seven1m
Copy link
Member Author

seven1m commented Aug 24, 2024

Also, 9 out of 10 of the child processes see the following error for every socket connection:

["Errno::EAGAIN", "Resource temporarily unavailable", ["server.rb:41:in `accept'", "server.rb:41:in `block in block in block in block'", "server.rb:40:in `loop'", "server.rb:40:in `block in block in block'", "server.rb:39:in `fork'", "server.rb:39:in `block in block'", "src/enumerable.rb:624:in `block in collect'", "src/enumerable.rb:624:in `each'", "src/enumerable.rb:624:in `collect'", "server.rb:38:in `<main>'"]]["Errno::EAGAIN", "Resource temporarily unavailable", ["server.rb:41:in `accept'", "server.rb:41:in `block in block in block in block'", "server.rb:40:in `loop'", "server.rb:40:in `block in block in block'", "server.rb:39:in `fork'", "server.rb:39:in `block in block'", "src/enumerable.rb:624:in `block in collect'", "src/enumerable.rb:624:in `each'", "src/enumerable.rb:624:in `collect'", "server.rb:38:in `<main>'"]]

It seems that server.accept returns one good connection and raises an error for all the other children waiting.

@funny-falcon
Copy link

It is well known issue with non-blocking accept from many threads/processes: kernel wakes all epool/poll/select waiters of socket, but only one succeed.

Nginx works around by using cross-process lock around waiting for accept. Some other servers use blocking listen socket and do accept in separate threads (iirc, Rainbow did it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants