Code upgrade messages

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Code upgrade messages

Marc Worrell
Hi,

For Zotonic we would love to be able to know if any Erlang module got a code upgrade (by loading a new version).
This because we use the list of exported functions to hook the module into the internal notification systems.

Is it possible to have a process that receives a code-upgrade notification for any module in the running Erlang beam.smp?

Best,

Marc
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Code upgrade messages

Dániel Szoboszlay
Hi,

I don't know about any such notifications, but you can simply trace the code_server process. It will send a {code_server, {module, M}} message right after loading module M.

Cheers,
Daniel


2015-06-05 10:17 GMT+02:00 Marc Worrell <[hidden email]>:
Hi,

For Zotonic we would love to be able to know if any Erlang module got a code upgrade (by loading a new version).
This because we use the list of exported functions to hook the module into the internal notification systems.

Is it possible to have a process that receives a code-upgrade notification for any module in the running Erlang beam.smp?

Best,

Marc
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Code upgrade messages

PAILLEAU Eric
In reply to this post by Marc Worrell
Hi,
You may 'simply' have to trace
delete_module(Module)
used by code server, with dbg or other tracing tools... And catch the Module name.

Le 5 juin 2015 10:17, Marc Worrell <[hidden email]> a écrit :

>
> Hi,
>
> For Zotonic we would love to be able to know if any Erlang module got a code upgrade (by loading a new version).
> This because we use the list of exported functions to hook the module into the internal notification systems.
>
> Is it possible to have a process that receives a code-upgrade notification for any module in the running Erlang beam.smp?
>
> Best,
>
> Marc
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions 
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Code upgrade messages

Marc Worrell
Hi,

Thanks for the suggestions and the idea to trace the code_server.
I have checked the code_server source code, and added a trace on the post_beam_load/1 function.


    erlang:trace_pattern(
                  {code_server, post_beam_load, '_'},
                  [{'_',[],[{return_trace}]}],  % dbg:fun2ms(fun(_) -> return_trace() end)
                  [local]),
    erlang:trace(whereis(code_server), true, [call]),


Now is hoping that that function is “stable” between releases :)

Thanks,

Marc


> On 6 jun. 2015, at 01:52, Éric Pailleau <[hidden email]> wrote:
>
> Hi,
> You may 'simply' have to trace
> delete_module(Module)
> used by code server, with dbg or other tracing tools... And catch the Module name.
>
> Le 5 juin 2015 10:17, Marc Worrell <[hidden email]> a écrit :
>>
>> Hi,
>>
>> For Zotonic we would love to be able to know if any Erlang module got a code upgrade (by loading a new version).
>> This because we use the list of exported functions to hook the module into the internal notification systems.
>>
>> Is it possible to have a process that receives a code-upgrade notification for any module in the running Erlang beam.smp?
>>
>> Best,
>>
>> Marc
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Code upgrade messages

PAILLEAU Eric
Hi,
Catch a special case on code_server module upgrade... ;-)

Le 8 juin 2015 12:20, Marc Worrell <[hidden email]> a écrit :

>
> Hi,
>
> Thanks for the suggestions and the idea to trace the code_server.
> I have checked the code_server source code, and added a trace on the post_beam_load/1 function.
>
>
>     erlang:trace_pattern(
>                   {code_server, post_beam_load, '_'},
>                   [{'_',[],[{return_trace}]}],  % dbg:fun2ms(fun(_) -> return_trace() end)
>                   [local]),
>     erlang:trace(whereis(code_server), true, [call]),
>
>
> Now is hoping that that function is “stable” between releases :)
>
> Thanks,
>
> Marc
>
>
> > On 6 jun. 2015, at 01:52, Éric Pailleau <[hidden email]> wrote:
> >
> > Hi,
> > You may 'simply' have to trace
> > delete_module(Module)
> > used by code server, with dbg or other tracing tools... And catch the Module name.
> >
> > Le 5 juin 2015 10:17, Marc Worrell <[hidden email]> a écrit :
> >>
> >> Hi,
> >>
> >> For Zotonic we would love to be able to know if any Erlang module got a code upgrade (by loading a new version).
> >> This because we use the list of exported functions to hook the module into the internal notification systems.
> >>
> >> Is it possible to have a process that receives a code-upgrade notification for any module in the running Erlang beam.smp?
> >>
> >> Best,
> >>
> >> Marc
> >> _______________________________________________
> >> erlang-questions mailing list
> >> [hidden email]
> >> http://erlang.org/mailman/listinfo/erlang-questions 
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions