Low listen() backlog
tihmstar opened this issue · comments
Expected Result
Spawning multiple darling shell
instances simultaneously from different processes (eg. different ttys) should work.
Actual Result
Some instances show error that connection to shellspawn.sock
failed
Steps To Reproduce
- Spawn many
darling shell
simultaneously
The issue is that in the listen()
call here: https://github.com/darlinghq/darling/blob/master/src/shellspawn/shellspawn.c#L88
The backlog is set to 1.
Instead the backlog should be set to a very large value.
I fixed it locally by setting it to 4096, but it may be worth setting it to an even higher number.
No need to worry about too high number, as linux automatically silently caps it.
Here is an except from the manpages
If the backlog argument is greater than the value in
/proc/sys/net/core/somaxconn, then it is silently capped to that
value. Since Linux 5.4, the default in this file is 4096; in
earlier kernels, the default value is 128. Before Linux 2.4.25,
this limit was a hard coded value, SOMAXCONN, with the value 128.