[erlang-questions] what does l/1 really do?

Shaun Kruger skruger@REDACTED
Fri Jul 29 22:22:16 CEST 2011


If I understand things correctly then simply loading the module should do it.  I hope someone corrects me if I'm wrong, but I believe that calling a fully qualified Module:Function() causes the latest code to be executed.  The OTP behaviours all do this fully qualified kind of call to get to the callbacks they use.  My experience in my projects is that I never have to do anything special before the newest version of code gets executed.

It is my expectation that OTP does something special to synchronize a code change for an OTP release upgrade so that all the OTP behaviour based modules stop executing briefly before the code upgrade happens.  If you aren't using those release upgrade facilities then the newest code gets executed the next time control passes to your module that implements the gen_fsm behaviour.

This has bit me a number of times in my development enviornment when I change the fields in a record and my module dies on a badrecord exception one short moment after I load the new version of code.

Shaun

----- Original Message -----
> From: "Daniel Dormont" <dan@REDACTED>
> To: "Håkan Mattsson" <hm@REDACTED>
> Cc: "erlang-questions" <erlang-questions@REDACTED>
> Sent: Friday, July 29, 2011 1:52:56 PM
> Subject: Re: [erlang-questions] what does l/1 really do?
> 
> 
> 
> 2011/7/29 Håkan Mattsson < hm@REDACTED >
> 
> 
> http://www.erlang.org/doc/man/c.html#l-1
> 
> 
> 
> Good to know. In my defense, I couldn't find anything in the manual
> that mentions "c" as the module to look in for those functions...
> 
> Any thoughts on my other question: if there are a variable-sized set
> of dynamically-launched gen_fsm's using a particular module,
> assuming most/all of them are idle or will be momentarily, is there
> a recommended way to propagate a code upgrade across all of them?
> 
> dan
> 
> 
> /Håkan
> 
> 
> On Fri, Jul 29, 2011 at 4:27 PM, Daniel Dormont
> < dan@REDACTED > wrote:
> 
> 
> 
> > While reading through some old discussion here or on TrapExit when
> > I was
> > first trying to understand hot code loading, I ran across the shell
> > command
> > l/1. Since then I've used it to good effect in patching a live
> > system
> > (Ejabberd, specifically) with new or upgraded modules. But I'd like
> > to
> > understand a little better what it's doing behind the scenes. I
> > didn't see
> > any mention of it in the manual, and it's a little hard to Google
> > for single
> > letters :), so I thought I'd ask here.
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list