41

I'm trying to run memcached on a centos box and it runs for a while, but then ends up in this state:

memcached dead but subsys locked

netstat shows this:

tcp        0      0 :::11211                    :::*                        LISTEN      
udp        0      0 0.0.0.0:11211               0.0.0.0:*                               

ps shows this:

nobody   21983  0.0  1.8  60272 19912 ?        Ssl  16:46   0:00 memcached -d -p 11211 -u nobody -c 1024 -m 64

Anyone know what that means?

1 Answer 1

65

This means the service was running at one time, but has crashed.

When you start a service, it creates a "lock" file to indicate that the service is running. This helps avoid multiple instances of the service. When you stop a service, this lock file is removed.

When a running service crashes, the lock file exists but the process no longer exists. Thus, the message.

Look at the two areas /var/run/*.pid and /var/lock/subsys/*. These are expected to agree with each other. That is, if the (emtpy file) lockfile /var/lock/subsys/crond exists, then the first line of the file /var/run/crond.pid is expected to contain the PID of the process running for this service. If no such process is running, then something is wrong. If a process is indeed running (as you see) but it is not that PID, then something is probably confused.

4
  • Isn't it still running if it's bound to a port and listed in ps? Jun 16, 2009 at 0:49
  • I extended my answer. Do "ls /var/lock/subsys/memcached" (I assume this file exists) and then "cat /var/run/memcached.pid" and look at the first line. The first line is the PID you should expect to see for memcached.
    – Eddie
    Jun 16, 2009 at 0:55
  • Sorry, I figured out what was going on. It was still running. I launched it using "sudo /sbin/service memcached start", but looking back in my history, I got the status using "/sbin/service memcached service". PEBCAK. All is well. Thanks for your help. Jun 16, 2009 at 1:00
  • 5
    Ah, and running the status not as root, you may not have had read access to /var/run/memcached.pid, thus, the command assumed the subsystem was dead because it couldn't locate the correct process.
    – Eddie
    Jun 16, 2009 at 1:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .