Systemd startup issue

#1

I have any Autobahn Python server that I’m trying to start on boot using Ubuntu 16.04 systemd. I start crossbar.io as a service also.

When my server starts on boot it logs that everything is going well until it calls reactor.run(), then it just goes silent. Once I log in I can simply do systemctl restart my-service and it works correctly.

I have logging in all my onJoin calls and so I know that none of them are getting called when it starts on boot.

One more detail. The start on boot works fine in a VM on a relatively new computer but fails on older, less powerful computers.

All this points to some timing-related issue that Autobahn is getting started before crossbar is ready. In fact, symptomatically, my service is acting just like it does if I start it without starting crossbar at all.

I have tried just delaying the start of my service with a long sleep. I believe I have dependencies properly set up between my service and crossbar.

Any ideas on how to debug this would be appreciated.

Thanks,

Mark

0 Likes

#2

Responding to myself here since I found exactly the answer I was looking for, but it seems little documented.

Some time ago Crossbar added support for the systemd notify mechanism. This mechanism tells systemd to wait for the service to notify systemd that it is up and running before loading dependent services. Normally systemd just starts the process and assumes that’s enough, but in the case of Crossbar and a client Autobahn application this isn’t good enough, at least not on all systems.

Here’s the PR related to this change: https://github.com/crossbario/crossbar/pull/637

The example pages for setting up Crossbar to run as a service does not mention using this feature: https://crossbar.io/docs/Automatic-Startup-and-Restart/

The example probably ought to show using “type=notify” instead of type=“simple”.

Hopefully that’s enough that anybody else running into this problem can figure it out.

···

On Thursday, November 9, 2017 at 9:56:58 AM UTC-6, Mark Harmison wrote:

I have any Autobahn Python server that I’m trying to start on boot using Ubuntu 16.04 systemd. I start crossbar.io as a service also.

When my server starts on boot it logs that everything is going well until it calls reactor.run(), then it just goes silent. Once I log in I can simply do systemctl restart my-service and it works correctly.

I have logging in all my onJoin calls and so I know that none of them are getting called when it starts on boot.

One more detail. The start on boot works fine in a VM on a relatively new computer but fails on older, less powerful computers.

All this points to some timing-related issue that Autobahn is getting started before crossbar is ready. In fact, symptomatically, my service is acting just like it does if I start it without starting crossbar at all.

I have tried just delaying the start of my service with a long sleep. I believe I have dependencies properly set up between my service and crossbar.

Any ideas on how to debug this would be appreciated.

Thanks,

Mark

0 Likes

#3

Hi Mark,

you are exactly right, the feature is there, but undocumented. I've filed your text as https://github.com/crossbario/crossbar/issues/1226

Sorry for the hassles!

Cheers,
Tobias

···

Am 13.11.2017 um 16:16 schrieb Mark Harmison:

Some time ago Crossbar added support for the systemd notify mechanism. This
mechanism tells systemd to wait for the service to notify systemd that it
is up and running before loading dependent services. Normally systemd just
starts the process and assumes that's enough, but in the case of Crossbar
and a client Autobahn application this isn't good enough, at least not on
all systems.

Here's the PR related to this change:
https://github.com/crossbario/crossbar/pull/637

The example pages for setting up Crossbar to run as a service does not
mention using this feature:
https://crossbar.io/docs/Automatic-Startup-and-Restart/

The example probably ought to show using "type=notify" instead of
type="simple".

Hopefully that's enough that anybody else running into this problem can
figure it out.

0 Likes