On Thu, 16 Aug 2012 15:33:29 +0300
Ciprian Dorin Craciun <ciprian.crac...@gmail.com> wrote:

> On Thu, Jul 26, 2012 at 1:09 PM, Peter Lemenkov <lemen...@gmail.com> wrote:
> > Hello All.
> > I'm trying to write a systemd service for epmd (Erlang Port Mapper
> > Daemon, if someone is curious). its only purpose is to open a TCP port
> > 4369 at 0.0.0.0 and act as a simple messaging (very simple actually)
> > bus between erlang nodes. I'd like to run it w/o anything and under a
> > most restricted system account. So far I'm using this service:
> 
> 
>     (Notice: Slightly off topic for systemd, but very on topic for EPMD...)
> 
>     Please be aware that starting `epmd` under a service monitoring
> system like systemd (or others) is not 100% possible under the current
> circumstances. For a detailed explanation please see the following
> thread on the Erlang mailing list:
>       http://erlang.org/pipermail/erlang-questions/2011-October/061802.html
> 
>     The summary is that if someone starts an Erlang application before
> your `epmd` instance starts you'll end up with your `epmd` dieing and
> being restarted by systemd in a continuous loop, because each Erlang
> application tries to start its own `epmd` instance. (Thus there is a
> race condition here.) In the thread above I've found a workaround for
> this issue but it's not quite "documented"...
> 
>     On the other hand if you would modify `epmd` to use socket
> activation at least the issue will be less likely to happen. (It can
> still happen if someone starts the Erlang application even before
> systemd.)
> 

Other workarounds might be one of the recent patches proposed here on
the list - either the one that controls "failure" exit code (provided
epmd returns "special" code on such conflicts) or the one that stops
restarts after some time, though I guess latter might be undesirable,
since if epmd gets started along with some service, it might also be
killed along with it at some point.

Another semi-fix might be just rate-limiting the restarts, which should
already be possible.

Whole problem seem to be at least a bit superficial though - if every
erlang daemon has Require=epmd.service, the only way to create it is by
starting erlang stuff and epmd from some user session, which is also a
way to break pretty much every other daemon which can only have one
instance (e.g. starting mysqld by hand will break mysqld.service).


-- 
Mike Kazantsev // fraggod.net

Attachment: signature.asc
Description: PGP signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to