Search code examples
linuxmonosystemdxsp

xsp4 service SystemD Service exits with "Start request repeated too quickly."


I am trying to run xsp4 as a systemd service in order to host WebAPI 2 application on Ubuntu 16.04. This is my service file:

[Unit]
Description=myapp xsp4 WebAPI 2
Wants=network.target

[Service]
Type=simple
User=www-data
Group=www-data
EnvironmentFile=/etc/myapp/env
ExecStart=/usr/bin/xsp4 --appconfigdir /etc/xsp4/ --root /var/www/myapp.com/server --address 127.0.0.1
Restart=on-failure

[Install]
WantedBy=multi-user.target

The command in ExecStart works fine when ran in shell (as root). When I start via systemd I get:

root@ubuntu-512mb-ams3-01:/etc/systemd/system# sctl status myapp.service 
● myapp.service - myapp xsp4 WebAPI 2
   Loaded: loaded (/etc/systemd/system/myapp.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Oct 07 14:32:00 ubuntu-512mb-ams3-01 systemd[1]: myapp.service: Start request repeated too quickly.
Oct 07 14:32:00 ubuntu-512mb-ams3-01 systemd[1]: Failed to start myapp xsp4 WebAPI 2.
Oct 07 14:59:12 ubuntu-512mb-ams3-01 systemd[1]: Stopped myapp xsp4 WebAPI 2.
Oct 07 14:59:16 ubuntu-512mb-ams3-01 systemd[1]: Started myapp xsp4 WebAPI 2.
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: xsp4
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Listening on address: 127.0.0.1
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Root directory: /var/www/myapp.com/server
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Listening on port: 9000 (non-secure)
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Hit Return to stop the server.
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: [0x7f24851e9700:] EXCEPTION handling: System.Threading.ThreadAbortException:

That System.Threading.ThreadAbortException does not occur when ran in shell. The actual error is "Start request repeated too quickly." because I configured mono to output all exceptions, even if caught - so this exception is not cause of exit.

Any advice ?


Solution

  • I will add the answer, because I myself was looking for.

    [Service]

    TimeoutStartSec=100

    ExecStart=/usr/bin/xsp4 --appconfigdir /etc/xsp4/ --root /var/www/myapp.com/server --address 127.0.0.1 --nonstop