Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are Erlang message queues persistent across processes?

This should be a simple question, but I don't know my way around the documentation well enough to find the answer.

If an OTP supervisor restarts a gen_server after it has crashed, does the new child process inherit the crashed process's message queue, or are messages sent before the crash but not yet processed by the old child dropped on the floor?

like image 704
regularfry Avatar asked Dec 04 '22 22:12

regularfry


1 Answers

No, a process never inherits any state set by a previous process. A supervisor will only restart the process with the same arguments used to start it in the first place.

If you want to recover state, you should make sure that such state is saved in a persistent manner (ETS tables, file on disk, database etc).

like image 148
Adam Lindberg Avatar answered Jan 14 '23 10:01

Adam Lindberg