memcached doesn't correctly daemonize

Bug #491685 reported by Robby
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Memcached Mirror
Unknown
Unknown
memcached (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: memcached

Ubuntu 9.10
memcached 1.2.8-1

it appears that launching memcached through the init.d scripts will cause it to daemonize in a way where it's still attached to the tty of the launching terminal/process. For instance, 'ps aux' shows:

nobody 16026 0.0 0.1 55976 2364 pts/0 Sl+ 00:47 0:00 /usr/bin/memcached -m 128 -p 11211 -u nobody

where if I launch the command like so:

root@chllab-dev1:/home/rbd# su nobody --
$ /usr/bin/memcached -d -m 128 -p 11211 -u nobody

I see:

nobody 4970 0.0 0.0 113816 884 ? Ssl 20:24 0:00 /usr/bin/memcached -d -m 128 -p 11211 -u nobody

Notice the command is not associated with a particular tty (good). This problem will not affect most people, but affects me because I have an application that will start up memcached when it starts up, and shut it down right before it's done shutting down. When my application receives a SIGINT, memcached gets the SIGINT as well and dies suddenly, where my app still needs it for the shutdown routine to complete.

The fix would be to have memcached's perl wrapper pass the -d flag along to the daemon...right now it appears that it ignores this, even if I uncomment it in the /etc/memcached.conf file

Changed in memcached (Ubuntu):
assignee: nobody → Clint Byrum (clint-fewbar)
status: New → In Progress
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

the start-memcached script is at fault, I reported the following upstream:

http://code.google.com/p/memcached/issues/detail?id=139

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Incorporating the patch I made upstream into the latest release.

Changed in memcached (Ubuntu):
status: In Progress → Confirmed
assignee: Clint Byrum (clint-fewbar) → nobody
Mathias Gug (mathiaz)
Changed in memcached (Ubuntu):
importance: Undecided → Wishlist
importance: Wishlist → Medium
importance: Medium → Low
assignee: nobody → Mathias Gug (mathiaz)
status: Confirmed → In Progress
Revision history for this message
Mathias Gug (mathiaz) wrote :

How about using perl Proc:Daemon directly rather than trying to copy it's code in the script?

Changed in memcached (Ubuntu):
status: In Progress → Triaged
assignee: Mathias Gug (mathiaz) → nobody
tags: added: patch
Mathias Gug (mathiaz)
tags: added: patch-forwarded-upstream
Revision history for this message
Scott Kitterman (kitterman) wrote :

Fixed in oneiric and later.

Changed in memcached (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.