[erlang-questions] Second try: .appup code_change timeout error

Ulf Wiger (TN/EAB) <>
Tue Apr 8 08:54:02 CEST 2008


Michael FIG skrev:
> Hi all,
> 
> I wrote this message a while ago, but haven't received any answer.
> Does anybody have a workaround for this situation?

Well, I believe you can insert something like:

{load_object_code, {myapp, Vsn, [mymod]},
{suspend, [{mymod, 60000}]},
{load, {mymod, soft_purge, soft_purge}},
{code_change, {mymod, Extra}},
{apply, {mymod, transform_files, [...]}},
{resume, [mymod]},
{purge, [mymod]}

If mymod represents a gen_server keeping the names of
files in its internal state, you'll have to figure out
how to make the transform_files() function aware of which
files it should transform - it can't call the server,
since it's suspended.

One dirty way of doing it is to call code_change twice,
using the Extra argument to tell the server to store
the file names in a public ets table, and then remove
the table on the second call. All is fair in love and
upgrades.

BR,
Ulf W



More information about the erlang-questions mailing list