Bug 878198 - Fails to write PID file, killed by systemd
Summary: Fails to write PID file, killed by systemd
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: memcached
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Paul Lindner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 878530 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-19 20:28 UTC by Pete Zaitcev
Modified: 2012-11-27 05:25 UTC (History)
5 users (show)

Fixed In Version: memcached-1.4.15-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-20 17:17:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Pete Zaitcev 2012-11-19 20:28:46 UTC
Description of problem:

memcached starts, but cannot write its PID file and then is killed by systemd

Version-Release number of selected component (if applicable):

memcached-1.4.13-2.fc18

How reproducible:

100%

Steps to Reproduce:
1. systemctl enable memcached
2. systemctl start memcached
   (this takes a while, be patient)
3. verify failure
  
Actual results:

memcached is not available after reboot

Expected results:

memcached works

Additional info:

This happens because, on the one hand, the directory for PID files
is created one level down:

[root@kvm-rei zaitcev]# more /etc/tmpfiles.d/memcached.conf
D /var/run/memcached/memcached 0710 memcached memcached -
[root@kvm-rei zaitcev]# ls -la /var/run/memcached/
total 0
drwxr-xr-x.  3 root      root       60 Nov 19 14:06 .
drwxr-xr-x. 22 root      root      760 Nov 19 14:06 ..
drwx--x---.  2 memcached memcached  40 Nov 19 14:06 memcached
[root@kvm-rei zaitcev]# 

But on the other hand, the unit file specifies the PID file
in /var/run/memcached/, owned by root:

[root@kvm-rei zaitcev]# more /usr/lib/systemd/system/memcached.service
.................
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/memcached
PIDFile=/var/run/memcached/memcached.pid
ExecStart=/usr/bin/memcached -d -u $USER -P /var/run/memcached/memcached.pid -p 
$PORT -m $CACHESIZE -c $MAXCONN $OPTIONS
.................
[root@kvm-rei zaitcev]# 

Once started by systemd, memcached cannot create PID file. Then,
systemd fails to find the PID file and terminates the control group.

The real root cause of the problem is using the "forking" type in the
unit file. The proper fix is to stop daemonizeing and use "simple" type.
In that case PID file is not necessary.

Comment 2 Joe Orton 2012-11-20 17:04:22 UTC
*** Bug 878530 has been marked as a duplicate of this bug. ***

Comment 3 Pete Zaitcev 2012-11-20 17:17:51 UTC
Verified fixed in memcached-1.4.15-1.fc19 (from Koji). Closing.

Comment 4 Fedora Update System 2012-11-20 17:26:32 UTC
memcached-1.4.15-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/memcached-1.4.15-2.fc18

Comment 5 Fedora Update System 2012-11-27 05:25:17 UTC
memcached-1.4.15-2.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


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