System.cmd throwing error (ErlangError) Erlang error: :eagain

Hello All,

What does the error below suggest?

** (ErlangError) Erlang error: :eagain
:erlang.open_port({:spawn_executable, '/path/encode'}, [:use_stdio, :exit_status, :binary, :hide, {:args, []}])
    (elixir 1.10.4) lib/system.ex:802: System.cmd/3

I have been using System.cmd for a long time in my code, but suddenly, it has began throwing the error above.

Any suggestions would be most appreciated.

Thank you.

Resource temporarily unavailable

2 Likes

Thanks, @denvaar.

I am still trying to figure out what system resource has been exhausted because all the various system parameters so far look okay.

What’s the script that you’re running do? By the way, if you look at the help docs for System.cmd/3 (Do this with h System.cmd in IEx console), it’s a little more specific about the error:

:eagain - there are no more available operating system processe

I am trying to run an external script, written in Ruby, to encrypt a file.

The second command you suggested did not have any effect.
I may probably have to restart the machine and see whether that will resolve the issue

After rebooting the server, it worked fine.

I am not too sure which system resources the Erlang VM was referring to.
Quite weird.

Thank you very much @denvaar for the assistance.

Regards,

Jerry

Most likely it was fork that returned eagain. From its manual:

       EAGAIN A system-imposed limit on the number of threads was
              encountered.  There are a number of limits that may
              trigger this error:

              *  the RLIMIT_NPROC soft resource limit (set via
                 setrlimit(2)), which limits the number of processes and
                 threads for a real user ID, was reached;

              *  the kernel's system-wide limit on the number of
                 processes and threads, /proc/sys/kernel/threads-max,
                 was reached (see proc(5));

              *  the maximum number of PIDs, /proc/sys/kernel/pid_max,
                 was reached (see proc(5)); or

              *  the PID limit (pids.max) imposed by the cgroup "process
                 number" (PIDs) controller was reached.