Ways to keep coding errors from crashing the Erlang VM?

Although the Erlang VM is designed to be very robust in the presence of coding errors, there are still a few ways to crash it. How to Crash Erlang describes several of these:

  • Run out of atoms.
  • Run out of processes.
  • Flood the mailbox for a process.
  • Create too many large binaries in a single process.

This makes me wonder whether there might be ways to protect the VM against these (and other) categories of coding errors. For example, I could imagine ways to monitor use of limited resources, killing aberrant processes before they can crash the VM.

Can anyone help me to understand why this hasn’t been done, at least as an option for use in pre-production testing? ELIF…

-r

1 Like

The first issue can be averted easily: Don’t create new atoms at runtime, if you need string to atom conversion just use String.to_existing_atom.

Other issues except the mailbox flooding seem to be related to running out of memory issue, because in the case of processes while you have a limit set, you can increase it with a flag when starting the VM. Large binaries are stored in a shared memory space and processes have pointers to them, so I don’t think there is a limit to how many big binaries you can reference.