Closed sigsergv closed 2 years ago
Looks like in the parent process we need to maintain an std::set of open file descriptors, and after the fork close them using the iterator. I'll put this on my to-do list, but not sure yet when I'll have time to work on this fix. Patches are welcome.
It would be a better solution to set FD_CLOEXEC on the file descriptors above 3, to eliminate the need in that loop all together, but FD_CLOEXEC only works with exec(2) and doesn't work with fork(2). However, since after fork there's a call to execve(2), this approach would work.
I believe this issue is fixed in the latest commit.
When you set ulimit value nofile to a large number like 600000 erlexec on each process execution tries to close 600000 descriptors and this increase execution time a lot for each run call.
To reproduce edit file
/etc/security/limits.conf
and set nofile limit to 600000 then relogin and try something like this:On systems under heavy load each execution of
exec:run
could take a few seconds.In
exec_impl.cpp
: