OpenMediaVault-Plugin-Developers / openmediavault-jdownloader

7 stars 6 forks source link

[3.0] Problem with systemd script #4

Closed Flachzange closed 8 years ago

Flachzange commented 8 years ago

Since a couple of days noticed a problem with the jdownloader.service: It restarted itself after a couple of minutes. Running jdownloader manually worked fine, so I had a look into systemd behaviour. From the logs I could see that the service never went to the "running" state :

jdownloader.service - jdownloader
   Loaded: loaded (/lib/systemd/system/jdownloader.service; enabled)
   Active: activating (start) since Wed 2016-04-27 21:40:22 CEST; 2min 56s ago
  Control: 19033 (java)
   CGroup: /system.slice/jdownloader.service
           └─19033 /usr/bin/java -Djava.awt.headless=true -jar JDownloader.jar

After a specified timeout systemd ran into a timeout and the service start failed: Apr 27 21:52:12 turk systemd[1]: jdownloader.service start operation timed out. Terminating.

 jdownloader.service - jdownloader
   Loaded: loaded (/lib/systemd/system/jdownloader.service; enabled)
   Active: failed (Result: timeout) since Wed 2016-04-27 21:43:22 CEST; 28s ago
  Process: 19033 ExecStart=/usr/bin/java -Djava.awt.headless=true -jar JDownloader.jar (code=exited, status=0/SUCCESS)

Apr 27 21:43:21 turk java[19033]: at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
Apr 27 21:43:21 turk java[19033]: at java.net.ServerSocket.implAccept(ServerSocket.java:530)
Apr 27 21:43:21 turk java[19033]: at java.net.ServerSocket.accept(ServerSocket.java:498)
Apr 27 21:43:21 turk java[19033]: at org.appwork.utils.singleapp.SingleAppInstance$1.run(SingleAppInstance.java:364)
Apr 27 21:43:21 turk java[19033]: at java.lang.Thread.run(Thread.java:745)
Apr 27 21:43:21 turk java[19033]: THREAD: 293
Apr 27 21:43:21 turk java[19033]: 293|Log.L.log 4/27/16 9:43:21 PM - FINER [ org.appwork.storage.JSonStorage(close) ] -> Start Saving Storage
Apr 27 21:43:21 turk java[19033]: 293|Log.L.log 4/27/16 9:43:21 PM - FINER [ org.appwork.storage.JSonStorage(close) ] -> ENDED Saving Storage
Apr 27 21:43:22 turk systemd[1]: Failed to start jdownloader.
Apr 27 21:43:22 turk systemd[1]: Unit jdownloader.service entered failed state.

I did some quick research here and it seems that simple java applications should not have type "forking". Instead "simple" should be used in the service file:

[Unit]
Description=jdownloader
After=network.target

[Service]
WorkingDirectory=/opt/jdownloader/
User=jdownloader
Group=users
Type=simple
UMask=000
ExecStart=/usr/bin/java -Djava.awt.headless=true -jar JDownloader.jar
RestartSec=15
Restart=always

[Install]
WantedBy=multi-user.target

With this change all problems are gone.

cptjhmiller commented 8 years ago

Strange as i have been running it fine on my end, will check this out and see if it makes any difference. Thanks for reporting it.

cptjhmiller commented 8 years ago

New version coming soon, open a new issue if problem persists.

RenWal commented 7 years ago

Commit ea41e66fff0f3b349dc5891364b6543eea4bcaca breaks this for me again. The change from Type=simple to Type=oneshot gets this service hung in activating state. This causes the service to show up as failed in the OMV Web Interface.