Code changing

Ulf Wiger etxuwig@REDACTED
Fri Oct 1 11:03:22 CEST 1999


On 30 Sep 1999, Luke Gorrie wrote:

luke>G'day all,
luke>
luke>A couple of questions about code changes in an erlang system.
luke>First, we're having a problem changing code in etk-using modules.
luke>The module itself is a gen_event and copes with code changes
luke>okay, but the command functions given to tk objects don't seem to
luke>work anymore. After a code change, I get:
luke>
luke>tkfun error: 1 : {function_clause,{messaging_gui,
luke>                                      module_lambda_1,
luke>                                      [10574021,[],{}]}}

In the existing commercial release, OTP R5B, funs don't break during code
change, but in R4B and OSE they do. Your only bet in Open Source (apart
from waiting for the next release) is either avoiding funs in your state,
or "recreating" them during code change (which is not always practical.)

luke>The other issue is with gen_event and code_change. If I don't
luke>make a code_change/3 function, my gen_event processes don't
luke>survive code changes. I put this down to some code in gen_event:
luke>
luke>{ok, NewState} = Module:code_change(OldVsn, H#handler.state, Extra),

Yes, this is something that isn't really documented: in reality, you need
to write dummy code_change() functions for all your process implementations
-- or fix the upgrade scripts by hand every time so that code change is
not performed (only suspend-load-resume), which is OK if no internal state
changes have occured.

The release handler interprets any EXIT (including undef) in a code change
function as an error -- as it should, I think.

This is true for all behaviours as well as for processes which handle their
own system messages: you must acknowledge the 'change_code' instruction if
it is present in the application upgrade script.

/Uffe

Ulf Wiger, Chief Designer AXD 301      <ulf.wiger@REDACTED>
Ericsson Telecom AB                          tfn: +46  8 719 81 95
Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44




More information about the erlang-questions mailing list