ejabberd 18.01 mod_http_upload already_started

Hi there,

running Debian, I recently went from 16.09 to 18.01 via backports (I've realized since then that I probably shouldn't have done this since, to quote the update page: "Only upgrade from version N to N+1 is documented and supported"). Well, the update went well except for mod_http_upload failing to start up now with this error message:

2018-02-13 00:51:55.903 [critical] <0.1517.0>@gen_mod:start_module:212 Problem starting the module mod_http_upload for host x3mpp.net
options: [{docroot,<<"/var/run/ejabberd/http-upload">>},
           {put_url,<<"https://x3mpp.net">>},
           {thumbnail,false}]
error: {error,{already_started,<0.1671.0>}}
[{gen_mod,start_module,4,[{file,"src/gen_mod.erl"},{line,203}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
{gen_mod,start_link,0,[{file,"src/gen_mod.erl"},{line,79}]},
{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,365}]},
{supervisor,start_children,3,[{file,"supervisor.erl"},{line,348}]},
{supervisor,init_children,2,[{file,"supervisor.erl"},{line,314}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]
2018-02-13 00:51:55.904 [critical] <0.1517.0>@gen_mod:maybe_halt_ejabberd:294 ejabberd initialization was aborted because a module start failed.

This error starts showing once I modify the put_url parameters in the module config away from the default of "https://@HOST@:5444". I'm using an otherwise vanilla config, except for the hostname and of course my own certs which are stored in the default location of "/etc/ejabberd/ejabberd.pem". Is there anything I'm missing? What can I do to further diagnose the problem?

Thanks in advance, cheers!

This happens because you

This happens because you configured ejabberd to serve several vhosts, like:

hosts:
  - "localhost"
  - "example.net"
  - "x3mpp.net"

But later, you configure the module with a fixed URL for the module in the three vhosts:

modules:
  mod_http_upload:
    put_url: "https://fixedurl:5444"

When ejabberd starts, it starts one instance of that module for each vhost. If the three instances of the module try to use the same URL, obviously the second and third will fail.

Solutions:
A) Have only one vhost
B) Define that option in a generic way, so it gets different for each vhost, as it was in the default value that used @HOST@
C) Configure that module differently for each vhost, see https://docs.ejabberd.im/admin/configuration/#virtual-hosting

This is precisely what was

This is precisely what was going wrong. Many thanks, badlop! :)

Sidenote for others hitting this issue: 16.09 was actually working with a broken config as described, I don't why that's the case.

Syndicate content