Global registry documentation has a cryptic warning about code change

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Global registry documentation has a cryptic warning about code change

Metin Akat
Hi,

Global has this warning box in the doc page:

"If you plan to change code without restarting your system, you must use an external fun (fun Module:Function/Arity) as function Resolve. If you use a local fun, you can never replace the code for the module that the fun belongs to."

Could someone please explain what this means?
If I have a simple_one_for_one supervisor with many workers which register via global, what does the above mean if I want to reload them via the `sync` library (for development). Can I not use the default Resolve and why?

Thanks,
Metin



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

Re: Global registry documentation has a cryptic warning about code change

Jesper Louis Andersen-2
It is a reference to the code replacement policy in Erlang:

http://erlang.org/doc/reference_manual/code_loading.html#id90252 (Section on Code Replacement in the Reference manual)

If you don't make an explicit call to the module, then the code will never replace if a newer version of the module is loaded. This means that when another load happens, the old version gets purged, and your process will then be terminated.

On Mon, Feb 26, 2018 at 10:37 AM Metin Akat <[hidden email]> wrote:
Hi,

Global has this warning box in the doc page:

"If you plan to change code without restarting your system, you must use an external fun (fun Module:Function/Arity) as function Resolve. If you use a local fun, you can never replace the code for the module that the fun belongs to."

Could someone please explain what this means?
If I have a simple_one_for_one supervisor with many workers which register via global, what does the above mean if I want to reload them via the `sync` library (for development). Can I not use the default Resolve and why?

Thanks,
Metin


_______________________________________________
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: Global registry documentation has a cryptic warning about code change

Metin Akat
OK, upon another inspection of the warning... it probably says that the Resolve function should be external to the module being reloaded.
Hence, global's resolve functions are perfectly fine in this regard, as they are external to my code.
Now it seems quite logical and quite simply explained. I don't know why I got confused at first.

On Mon, Feb 26, 2018 at 2:20 PM, Jesper Louis Andersen <[hidden email]> wrote:
It is a reference to the code replacement policy in Erlang:

http://erlang.org/doc/reference_manual/code_loading.html#id90252 (Section on Code Replacement in the Reference manual)

If you don't make an explicit call to the module, then the code will never replace if a newer version of the module is loaded. This means that when another load happens, the old version gets purged, and your process will then be terminated.

On Mon, Feb 26, 2018 at 10:37 AM Metin Akat <[hidden email]> wrote:
Hi,

Global has this warning box in the doc page:

"If you plan to change code without restarting your system, you must use an external fun (fun Module:Function/Arity) as function Resolve. If you use a local fun, you can never replace the code for the module that the fun belongs to."

Could someone please explain what this means?
If I have a simple_one_for_one supervisor with many workers which register via global, what does the above mean if I want to reload them via the `sync` library (for development). Can I not use the default Resolve and why?

Thanks,
Metin


_______________________________________________
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