[erlang-questions] Hot code replacement issues ?
Wed Dec 14 11:34:57 CET 2016
Switch to new version of code happens, when fully qualified
function is called:
1) Switch to new code version happens:
2) Old code will remain in use:
> On 14 Dec 2016, at 12:28, Alex Feng <> wrote:
> Hi Erlangers,
> I am trying to understand how hot patch upgrade is done in Erlang, I got this piece of code from stackoverflow, but I ran into 2 issues when I played around with it.
> Issue 1) In the piece of code, I suppose to send a message 'upgrade' to the running process, then it will finish the upgrade. It is working fine with "?MODULE:loop();", but if I remove the prefix ?MODULE in the code, then the upgrade will be failed, I mean when I send message 'run' after upgrade neither the new message nor the old message are printed.
> Issue 2) I was told if I recompile and reload the updated file from shell, then it will be done as well.
> So, I did this from shell, update the source file -> compile the file -> reload it ->send msg 'run' to the same process -> 'new version' is not printed out. What could be the mistake?
> loop() ->
> upgrade ->
> ?MODULE:loop(); %%without ?MODULE, it has problem.
> run ->
> io:format("This is a new version ~n"), %% before upgrade, the text is 'old version'.
> _ ->
> Thank you.
> erlang-questions mailing list
The single biggest problem in communication is the illusion that it has taken place. (George Bernard Shaw)
More information about the erlang-questions