Bug 36492 - memcached: Unclear where the pid file of memcached should be
Summary: memcached: Unclear where the pid file of memcached should be
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-02 13:51 UTC by Marcel de Rooy
Modified: 2024-11-07 10:54 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2024-04-02 13:51:20 UTC
Sometimes at container restart the memcached process does not come up for some reason. (Running Debian11.)

In the logs I found:
Could not open the pid file /var/run/memcached/memcached.pid.tmp for writing: No such file or directory

The *funny* thing is that the init.d script refers to /var/run/memcached.pid but the /etc/memcached.conf file contains:
-P /var/run/memcached/memcached.pid

In my case this folder does not exist in /var/run.

Seems like a Debian problem, but directly affects daily Koha operation. Solving it temporarily by a sed on memcached.conf. Maybe this workaround may also help others.
Comment 1 Marcel de Rooy 2024-04-03 11:50:39 UTC
Changing the conf file is not the complete answer. Actually this fix from https://github.com/saz/puppet-memcached/issues/27 does it the other way around:

mkdir /var/run/memcached
chown memcache:memcache /var/run/memcached
memcached.conf should (still) contain: -P /var/run/memcached/memcached.pid

What happens now when stopping and starting? (Note that /etc/init.d/memcached stop does not work! Try: start-stop-daemon --stop --quiet --oknodo --retry 5 --name memcached)

In var/run:
-rw-r--r-- 1 root        root           5 Apr  3 13:24 memcached.pid
In var/run/memcached:
-rw-r--r-- 1 memcache memcache 6 Apr  3 13:24 memcached.pid

Both files contain the same PID but the latter one contains a newline too.
A new stop/start will create new pid files. No warnings anymore.
Comment 2 Marcel de Rooy 2024-11-07 10:54:04 UTC
This confusing situation still exists under Debian 12 btw.