allen8807 / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

-d with local -P fail #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
[brian@gaz ~]$ memcached -d -P ./out

Works! But....

[brian@gaz ~]$ ls -l out
out: No such file or directory

[brian@gaz ~]$ ps auwx | grep memcached
brian    11187  0.0  0.0  55332  1504 ?        Ssl  18:19   0:00 memcached -d 
-P ./out

I should be able to specify where I want the pid-file. 

Also, if the daemon is not going to write out the pid file, then throw an 
error. 

Also, I don't see why I should have to specify -d to get -P. 

Original issue reported on code.google.com by br...@tangent.org on 21 Dec 2011 at 2:55

GoogleCodeExporter commented 9 years ago
This was originally added in 032912ce0c3a1cbf3a14395a8a621f48544ddc71
but trond changed part of it in a bug fix: 
af48b1005639d3cb1dea4e08dd9d2e33a2289a95

in trond's change he silently removed the need for the -d flag to create the 
pidfile, but nothing deletes it on exit. You'll also never see the errors from 
it.

I may punt on this for 1.4.12 since it might be necessary to do a little more 
refactoring to get this "correct": open the pidfile pre-fork, write any error 
about trying to open it. fork, then listen or die?

Anyway, will fix it. maybe just not right now.

Original comment by dorma...@rydia.net on 12 Jan 2012 at 1:23

GoogleCodeExporter commented 9 years ago
Pinging back here...

The reason why a local pidfile doesn't work with daemonize is because it 
chdir's to / after fork'ing, unless you specify a nonzero maxcore.

So giving it a full path will still work... and -P already works without -d.

I'm trying to convince myself to not punt for another release, but I might. 
Doing this correctly is a fair amount of rewiring and we're about to look at 
the 1.6 tree again, so I'd like to avoid writing even more core code to port.

IE: We'd have to keep the parent process around listening on a pipe and shuttle 
errors/commands around, which means we can't call perror anymore, blah blah.

Original comment by dorma...@rydia.net on 30 Jul 2012 at 1:03

GoogleCodeExporter commented 9 years ago
HELLO WORLD

Original comment by shaoyong...@gmail.com on 5 Jan 2015 at 6:59

GoogleCodeExporter commented 9 years ago
closing old issues. I think we have a general TODO item for keeping the parent 
alive until the child is done setting up.

Original comment by dorma...@rydia.net on 5 Jul 2015 at 1:40