UMS is not stopping

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
MetaRZA
Posts: 7
Joined: Tue Mar 07, 2023 8:43 am

UMS is not stopping

Post by MetaRZA »

System: AlmaLinux 8
Version: UMS 13.2.0
Java: java-1.8.0-openjdk-1.8.0.362.b09-2.el8_7.x86_64

UMS is started via systemd (systemctl start ums) (see attachment).

When I stop the service (systemctl stop ums) it will always hang for 1m30s and then use SIGKILL to kill the process.

After which I see (systemctl status -l ums)

Code: Select all

� ums.service - Universal Media Server
   Loaded: loaded (/etc/systemd/system/ums.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Mon 2023-03-06 15:42:03 EST; 7min ago
  Process: 20999 ExecStop=/usr/bin/pkill --signal SIGINT -f java .*ums.jar.* (code=exited, status=0/SUCCESS)
  Process: 20354 ExecStart=/opt/ums/startup.sh (code=killed, signal=KILL)
 Main PID: 20354 (code=killed, signal=KILL)

Mar 06 15:39:39 henry.localdomain systemd[1]: Started Universal Media Server.
Mar 06 15:40:33 henry.localdomain systemd[1]: Stopping Universal Media Server...
Mar 06 15:42:03 henry.localdomain systemd[1]: ums.service: State 'stop-sigterm' timed out. Killing.
Mar 06 15:42:03 henry.localdomain systemd[1]: ums.service: Killing process 20354 (java) with signal SIGKILL.
Mar 06 15:42:03 henry.localdomain systemd[1]: ums.service: Main process exited, code=killed, status=9/KILL
Mar 06 15:42:03 henry.localdomain systemd[1]: ums.service: Failed with result 'timeout'.
Mar 06 15:42:03 henry.localdomain systemd[1]: Stopped Universal Media Server.
This means turnning off my media server takes an extra 1m30s, which could be a problem during a blackout.

Anyone have an idea on why UMS doesn't stop when asked politely?
Attachments
ums-shutdown.zip
(557.64 KiB) Downloaded 59 times
User avatar
mik_s
Moderator
Posts: 1115
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: UMS is not stopping

Post by mik_s »

I don't know anything about the shutdown sequence but it has been a problem for a while.

Usually I see errors in logs due to the ports or database still being in use when trace logs are generated because when UMS is restarted as a new process the old one is still shutting down and still using them.

I think a part of that is to make sure everything has fully completed its process to prevent any corruption to the database and to inform everything on the network that it is shutting down. I'm sure this could be optimised better as the library scanner was still working at the end of the logs.
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
MetaRZA
Posts: 7
Joined: Tue Mar 07, 2023 8:43 am

Re: UMS is not stopping

Post by MetaRZA »

It occurred to me that I am the Programmer Born, so I grabbed the source code from git, recompiled and ran that. Using 13.2.1-SNAPSHOT, UMS shuts down correctly.

The jre17 shipping with 13.2.0 (BellSoft 17.0.5, 2022-10-18) is different from the jre17 I compiled with (BellSoft 17.0.6, 2023-01-17).

Next step, compile 13.2.0 and see if problem returns.
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: UMS is not stopping

Post by boss »

I run UMS on a headless Gentoo Linux server.
My system java is always kept up to date.
I always modify UMS.sh so UMS uses my system java and not the UMS supplied java.

In UMS.sh change:
# Use our JVM if it exists
if [ -f jre17/bin/java ]; then
JAVA="jre17/bin/java"
fi

To:
# Use our JVM if it exists
#if [ -f jre17/bin/java ]; then
# JAVA="jre17/bin/java"
#fi
MetaRZA
Posts: 7
Joined: Tue Mar 07, 2023 8:43 am

Re: UMS is not stopping

Post by MetaRZA »

UMS 13.2.0 compiled with JRE17.0.6+10 shuts down correctly.
UMS 13.2.0 compiled with JRE17.0.5+8 shuts down correctly.
I reinstalled UMS from UMS-13.2.0-x86_64.tgz and now it shuts down correctly.
I tried precompiled UMS using a system java (bellsoft-java17) and it shuts down correctly.
I tried precompiled UMS using a system java (java-19-openjdk-19.0.2.0.7-1.rolling.el8) and it shuts down correctly.
Unfortunately I managed to muck up my initial install of UMS. The one that was causing the problem.

In other words, I'm now unable to reproduce the problem.
MetaRZA
Posts: 7
Joined: Tue Mar 07, 2023 8:43 am

Re: UMS is not stopping

Post by MetaRZA »

boss wrote: Thu Mar 09, 2023 1:53 pm In UMS.sh change:
A better way to do this is to just move the jre17 directory out of the way :

Code: Select all

cd /dir/you/installed/ums/in
mv jre17 jre17-NOT
You can confirm which JRE is being used with lsof :

Code: Select all

lsof -c java | grep libjavajpeg
User avatar
mik_s
Moderator
Posts: 1115
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

Re: UMS is not stopping

Post by mik_s »

MetaRZA wrote: Thu Mar 09, 2023 3:13 pm In other words, I'm now unable to reproduce the problem.
I hate it when that happens. You find a problem and go tracking it down until you accidentally fix it and are unable to reproduce :x

On the plus side it is now working as intended :D
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: UMS is not stopping

Post by boss »

A better way to do this is to just move the jre17 directory out of the way :

Either way has the same end result.
I prefer to modify UMS.sh to prevent UMS even checking for the UMS java version in the first place.
MetaRZA
Posts: 7
Joined: Tue Mar 07, 2023 8:43 am

Re: UMS is not stopping

Post by MetaRZA »

boss wrote: Thu Mar 09, 2023 5:26 pm I prefer to modify UMS.sh to prevent UMS even checking for the UMS java version in the first place.
Fair enough.

I'm curious as to why you want to use the system Java and not the one shipped by UMS.
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: UMS is not stopping

Post by boss »

The main reason I like to use my system java is because I do any updates on my server once a week.
Java with UMS is V17.0.5 and my system java is V17.0.6.

It's not a big deal but sometimes the java version included with UMS can be quite a bit older.
Post Reply