record problem

Valentin Micic <>
Sun Jun 18 13:19:28 CEST 2006


Sometimes if one changes state variable returned by gen_server (or any other 
behaviour) callback module, and then dyunamically upgrade code, run-time may 
report error like this one.
For example, if you had a gen_server callback module with a state variable 
like this:

-record( state, {x="X"} )

Later, if  you start the server  and change the code with new state variable 
modified to:

-record( state, {x="X", y="Y"} )

and compile & deploy the code, but fail to restart the server, the 
gen_server loop shall pass the old record definition {state, "X"}, whilst 
callback module would expect, something like {state, "X", "Y"}. If you do 
not have *catch_all* pattern, the program shall crash.

Would this be applicable to your case?

V.

----- Original Message ----- 
From: "bryan rasmussen" <>
To: "Erlang Questions" <>
Sent: Sunday, June 18, 2006 12:07 PM
Subject: record problem


> Why does this
>
> -record(a,{b="b",c="c"}).
> give this
>
> =ERROR REPORT==== 18-Jun-2006::12:03:20 ===
> Error in process <0.168.0> with exit value: 
> {{badmatch,"b"},[{erl_eval,expr,3}]}
>
>
>
> ** exited: {{badmatch,"b"},[{erl_eval,expr,3}]} **
>
>
>
> In Erlang 5.4.13
>
> Cheers,
> Bryan Rasmussen
> 




More information about the erlang-questions mailing list