Bug 17729 - Fedora service control fumbles after server restart
: Fedora service control fumbles after server restart
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Misc
: 7.6.2
: PC Linux (other)
: P3 normal with 1 vote (vote)
: 7.8.0
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-05 12:03 UTC by quiet.dragon
Modified: 2012-03-21 02:32 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
Proposed patch against 7.7 trunk (7.39 KB, patch)
2011-12-26 09:17 UTC, quiet.dragon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description quiet.dragon 2011-11-05 12:03:44 UTC
My server is installed on Fedora as a service which is controlled via:

service squeezeboxserver { start | stop }


See http://svn.slimdevices.com/repos/slim/7.6/trunk/platforms/fedora/SOURCES/slimserver.init

I discovered that the service control is unable to stop the server if the server previously been restarted (eg a plugin had previously been installed).

The root cause is that pidof(8) is unable to find the newly minted server for the following reasons:

pidof(8) is looking for a script by comparing comm field in /proc/<pid>/stat with the basename of argv[1].

When started as a service, the server relies on the #! in slimserver.pl to run the script. This causes the executable to have a comm value of (slimserver.pl).

When the server restarts itself, it uses the command line equivalent of "perl slimserver.pl ..." and the newly minted instances gets a comm field value of (perl).

pidof(8) can no longer find the script process running the server.
Comment 1 Mikael Nyberg 2011-11-16 20:42:12 UTC
A duplicate bug https://bugs-archive.lyrion.org/show_bug.cgi?id=15523
Comment 2 Michael Herger 2011-11-16 22:05:14 UTC
*** Bug 15523 has been marked as a duplicate of this bug. ***
Comment 3 Michael Herger 2011-11-16 22:06:34 UTC
*** Bug 13664 has been marked as a duplicate of this bug. ***
Comment 4 quiet.dragon 2011-12-26 09:17:18 UTC
Created attachment 7592 [details]
Proposed patch against 7.7 trunk

http://forums.slimdevices.com/showthread.php?t=91595
Comment 5 quiet.dragon 2011-12-26 09:22:47 UTC
Add Andy to cc as per

http://forums.slimdevices.com/showpost.php?p=674973&postcount=20
Comment 6 Michael Herger 2012-03-05 04:33:09 UTC
A few comments about that patch:

- when calling restartServer() we must not stop the server if it can't be restarted
- for the sake of legibility I'd change the OSX restart routing to use a regular if... else... statement
- any good reason to remove the early return with warning on systems running perl on Windows?
- $::stop = 1; should be left in (slimserver.pl) to tell the main loop that we want to stop
Comment 7 Andy Grundman 2012-03-05 09:04:17 UTC
Would using $0 to set the process name work too? Might be simpler.
Comment 8 quiet.dragon 2012-03-05 21:37:57 UTC
(In reply to comment #7)
> Would using $0 to set the process name work too? Might be simpler.

Writing to $0 doesn't necessarily invoke PR_SET_NAME.



http://www.gossamer-threads.com/lists/perl/porters/249164

http://search.cpan.org/~opi/Sys-Proctitle-0.04/lib/Sys/Proctitle.pm
Comment 9 Michael Herger 2012-03-20 03:37:40 UTC
See
Comment 10 Michael Herger 2012-03-20 04:14:07 UTC
*** Bug 17440 has been marked as a duplicate of this bug. ***
Comment 11 SVN Bot 2012-03-20 04:15:17 UTC
 == Auto-comment from SVN commit #33898 to the slim repo by mherger ==
 == http://svn.slimdevices.com/slim?view=revision&revision=33898 ==

Bug: 17729
Description: apply patch to clean up restart behaviour - thanks quiet.dragon!
Comment 12 Michael Herger 2012-03-20 04:27:08 UTC
*** Bug 17730 has been marked as a duplicate of this bug. ***
Comment 13 Michael Herger 2012-03-20 04:31:34 UTC
Verified on a CentOS 4 based system.
Comment 14 Michael Herger 2012-03-20 06:15:02 UTC
Verified on Windows 7 & OSX 10.5
Comment 15 Mikael Nyberg 2012-03-20 11:15:32 UTC
Nope none of the issues are fixed on ClarkConnect 4.2 Linux

# service squeezeboxserver restart
/sbin/service: line 68: 22339 Terminated              env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

Restart does not work .

Start after install does not work

And I cant leave the ssh session in a nice way

Essentially the same as it was when 7.4 was introduced 

https://bugs-archive.lyrion.org/show_bug.cgi?id=13664 this bug is marked as a duplicate of this one ?

I would not call it fixed.

Rebooting the server still works
Comment 16 Michael Herger 2012-03-20 11:28:27 UTC
Which exact build did you install? This is in 7.8 only, not in 7.7.2.

Please note that the first shutdown/restart probably will fail, as you're still running the old version.
Comment 17 Mikael Nyberg 2012-03-20 11:40:46 UTC
I installed:

Logitech Media Server Version: 7.8.0 - r33899 @ Tue Mar 20 10:16:14 MDT 2012
Hostname: hal.home.lan
Server IP Address: 192.168.1.5
Server HTTP Port Number: 9000
Operating system: Red Hat - EN - utf8
Platform Architecture: i686-linux
Perl Version: 5.8.8 - i686-linux-thread-multi
Database Version: DBD::SQLite 1.34_01 (sqlite 3.7.7.1)
Total Players Recognized: 4
Comment 18 Michael Herger 2012-03-21 02:32:32 UTC
Mikael - I re-opened your bug, which indeed is something different. Let's continue discussion there. Thanks!