Bug 1057867 - wrong location of the systemd unit
Summary: wrong location of the systemd unit
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: sipwitch
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: David Sugar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1058966 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-25 14:19 UTC by Michael S.
Modified: 2014-02-20 06:55 UTC (History)
4 users (show)

Fixed In Version: sipwitch-1.8.7-1.fc20
Clone Of:
Environment:
Last Closed: 2014-02-04 02:43:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Michael S. 2014-01-25 14:19:49 UTC
Description of problem:
# rpm -ql sipwitch | grep servi
/usr/lib64/systemd/system/sipwitch.service


it should be in /usr/lib/systemd so systemd can use the file.

Comment 1 David Sugar 2014-01-25 14:31:16 UTC
I see we currently use the %{_libdir} prefix in the spec file for the install location, and install it similarly based on the autoconf/automake $(libdir) path in the package makefile...

I think in the autoconf side to fix that we probably change server/Makefile.am:

systemddir=$(libdir)/systemd/system

to

systemddir=$(prefix}/lib/systemd/system

and then fix the spec files...

Comment 2 Michael S. 2014-01-25 14:54:08 UTC
Yep.

Also, the unit file is a bit too complex this one work fine :

# cat /etc/systemd/system/sipwitch.service 
[Unit]
Description=GNU SIP Witch, a SIP telephony service daemon.
After=network.target

[Service]
Type=simple
PIDFile=/var/run/sipwitch/pidfile
EnvironmentFile=-/etc/conf.d/sipwitch
EnvironmentFile=-/etc/sysconfig/sipwitch
EnvironmentFile=-/etc/default/sipwitch
ExecStart=/usr/sbin/sipw -f $OPTIONS
Restart=always

[Install]
WantedBy=multi-user.target


There is no need to sleep with type=simple, since systemd will wait on the process to stopped. It also send a simple sigterm so there is no need to write "stop" to the control socket. 

I have removed the removal of the socket, but maybe if sipwitch crash, it should be kept. I was just in a cleaning spree :)

Comment 3 David Sugar 2014-01-25 15:02:04 UTC
Well, it was my very first systemd unit file :)

Do we really want to run sipw in foreground mode?  Well, I guess since it is already deamonfied through systemd, that part does not matter, and certainly it is easier to track the final pid.  And yes, this makes the rest of it simpler.

Comment 4 David Sugar 2014-01-25 17:54:40 UTC
(In reply to Michael Scherer from comment #2)
> Yep.
> 
> Also, the unit file is a bit too complex this one work fine :
> 

All of this I took as an upstream fix for 1.8.7.  Of course, it also was easy to rebuild/update in rawhide.  I am looking for an opinion on F20, however...

In F19/F20, I kept sipwitch at 1.6.1.  This is because all work past that really was for supporting the newer exosip2 4.x api (which is supported alongside the older exosip2 releases), and F20 did not have this as yet.

I could migrate F20 to 1.8.7, or I could do a patch for 1.6.1.  Offhand I see no real downside to updating F20 to 1.8.7, and really it does not effect/does not have any impact on any other Fedora packages.  But I am hoping to get some additional feedback before arbitrarily doing so.

> # cat /etc/systemd/system/sipwitch.service 
> [Unit]
> Description=GNU SIP Witch, a SIP telephony service daemon.
> After=network.target
> 
> [Service]
> Type=simple
> PIDFile=/var/run/sipwitch/pidfile
> EnvironmentFile=-/etc/conf.d/sipwitch
> EnvironmentFile=-/etc/sysconfig/sipwitch
> EnvironmentFile=-/etc/default/sipwitch
> ExecStart=/usr/sbin/sipw -f $OPTIONS
> Restart=always
> 
> [Install]
> WantedBy=multi-user.target
> 
> 
> There is no need to sleep with type=simple, since systemd will wait on the
> process to stopped. It also send a simple sigterm so there is no need to
> write "stop" to the control socket. 
> 
> I have removed the removal of the socket, but maybe if sipwitch crash, it
> should be kept. I was just in a cleaning spree :)

Comment 5 Michael S. 2014-01-25 20:18:37 UTC
While I would be very conservative on stable upgrade, this is on the other hand a software you know quite well, and that seems quite stable. And having a new version would provides more feedback to you as upstream. So I would go for a upgrade.

Comment 6 Fedora Update System 2014-01-26 01:07:11 UTC
sipwitch-1.8.7-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/sipwitch-1.8.7-1.fc20

Comment 7 Fedora Update System 2014-01-26 11:55:16 UTC
Package sipwitch-1.8.7-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing sipwitch-1.8.7-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-1566/sipwitch-1.8.7-1.fc20
then log in and leave karma (feedback).

Comment 8 David Sugar 2014-01-28 22:10:23 UTC
*** Bug 1058966 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Update System 2014-02-04 02:43:43 UTC
sipwitch-1.8.7-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 David Sugar 2014-02-18 19:08:31 UTC
Now that Debian has chosen systemd too, I have decided to add sd_notify support in the next pending release (1.8.9||1.9.0), as there is an internal "up" flag in sipw itself that gets set when it is "really" up and ready.  That seems to be what sd_notify READY=1 is for...  So I will have a new unit file with Type=notify starting with that release (and tied to a new sipw "-S" option...) rather than overloading use of -f mode, which really was originally meant for debugging.

Comment 11 Michael S. 2014-02-19 07:07:16 UTC
I would also recommend looking at the new monitoring protocol that is being implemented in the next systemd version, to restart sipw in case of freeze, but that should wait until systemd is out this week ( and wait until a backport or something, that's just a FYI ). The protocol is quite easy, just sending some message using sd_notify every X/2 seconds to notify the watchdog, that can be integrated quite easyly in the main loop ( most of the time, didn't look at sipw code but I do not expect much issues ).

Comment 12 David Sugar 2014-02-19 11:16:01 UTC
I am not sure a closed bug report is the best place to discuss this, but yes, we actually do have a heartbeat thread in sipw itself to do housecleaning and internal reaping, and it would seem rather natural to do so from that.  I am going to experiment with systemd changes and integration in rawhide for F21 rather than effect F20, of course.  Perhaps it should be submitted and discussed formally as a F21 "changes" proposal on the Fedora wiki, but it seems rather small for that...

If we do add heartbeat notifications from sd_notify for newer systemd, are they ignored when ran on systems with older systemd releases?  Or will we have to explicitly test systemd versions at build time?  If there are changes in the unit file to enable monitoring support, do older systemd releases ignore that?

Comment 13 Michael S. 2014-02-20 06:55:47 UTC
yeah, agreed, maybe we shouldn't discuss here :)

And yes, message are ignored, there is future proofing.


Note You need to log in before you can comment on or make changes to this bug.