You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
add note about Unix.select and "Invalid argument" errors #222
Please update the manual to mention that if you see an Invalid argument' onUnix.select' it means that this 1024 file descriptor limit was exceeded:
"libev is used by default on Unix, because it supports any number of file descriptors while Unix.select supports only 1024 at most, and is also much more efficient. "
(and sometimes it would fail with Unix_error 12, which would be ENOMEM).
The problem was that lwt wasn't built with libev, and it falled back to Unix.select.
If you google for EINVAL on select you usually see that the timeout argument might be wrong, but that was not my case.
OCaml's Unix.select also fails with EINVAL if the maximum file descriptor number exceeds FD_SET_SIZE (1024 on Linux), which I found out by looking at its source code.
I was running my app inside a Docker container, where the default ulimit -n is 1048576, so although ocsigen would only accept 350 connections by default, some file descriptor numbers would exceed 1024 (even if it didn't actually try to poll more than 1024 at a time), and cause this error.
Switching to libev solved all these problems.
Reacted by @edgararout, Hannes Mehnert, Thomas Leonard, Anton Bachin, Konstantin A. Olkhovskiy, pveber and Robin Björklin
Activity
hannesm commentedon Apr 8, 2016
thanks @edwintorok for writing this up! I just encountered the very same issue...
aantron commentedon Apr 29, 2016
Where in the manual would it have been the most useful, as in with the greatest chance of you seeing it? PRs are also welcome :)
Fix Unix.EINVAL exceptions (maybe).
Docs: note about Unix.select descriptor limit