Relup file generated by systools ignores application dependencies.

Miriam Pena <>
Thu Jun 24 14:29:30 CEST 2010


I am running R13B04 on a Linux Ubuntu. I create a target_system "myapp-FIRST" with the target_system:create() and I want to perform a live upgrade it with a new release version "myapp-SECOND".

{release, {"myapp", "FIRST"},{erts,"5.7.5"}, [
        {kernel, "2.13.5"},
        {stdlib, "1.16.5"},
        {sasl, "2.1.9"},
        {app1, "1"},
        {app2, "1"}

 {release, {"myapp", "SECOND"},{erts,"5.7.5"}, [
        {kernel, "2.13.5"},
        {stdlib, "1.16.5"},
        {sasl, "2.1.9"}

Release "myapp-FIRST" has app1 and app2 applications where app2 application depends on app1. Sice "myapp-SECOND" doesn't include this two applications I expect the applications to be stopped and removed from the system when I install release "myapp-SECOND". The new release is unpacked sucesfully but cant be installed, since the Erlang node crashes and dies.

()3> release_handler:install_release("SECOND").   
** exception exit: {shutdown,{gen_server,call,
     in function  gen_server:call/3
()4> {"Kernel pid terminated",application_controller,"{application_terminated,app2,shutdown}"}

Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_terminated,app2,shutdown})

The problem lays in the relup file created via systools: systools:make_relup("myapp-SECOND", ["myapp-FIRST"], ["myapp-FIRST"]), which is not generated properly. When I go from release FIRST to release SECOND, the first application to be removed and purged is the app1 application, but since the app2 have running processes depending on that application, those processes are killed and the node shutdowns. 

=INFO REPORT==== 24-Jun-2010::12:29:55 ===
    application: app1
    exited: stopped
    type: permanent

=ERROR REPORT==== 24-Jun-2010::12:29:55 ===
    supervisor: {local,app2_sup}
    errorContext: child_terminated
    reason: killed
    offender: [{pid,<0.56.0>},

I would expect that the relup file is generated taking the dependencies specified in the .app files into account but I got them generated in the same order as the .rel files. 

If I reverse-order the myapp-FIRST.rel I will success to install the new release, but I will not be able to go back to the "myapp-FIRST" release correctly. The new relup file specify that the app2 should be started before app1, and since it cant because of its dependency with app1, the application app2 will not be started.

Here is a simplified version of the relup.

    {remove,{app2,brutal_purge,brutal_purge}}, [...]
    {purge,[app2, app2_sup, ...]},
    {load,{app2,brutal_purge,brutal_purge}}, [...]

I am not using apupp files since I am not upgrading applications. I would like to know whether not taking dependencies into account when the relup files are generated via systools is the intended behaviour or a bug. 

Miriam Pena Villanueva



Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

More information about the erlang-questions mailing list