memcached posix threads and pidfile problem

Marlon de Boer marlon at supersnel.adsl.utwente.nl
Tue Oct 9 14:50:42 UTC 2007


Hi list,

I had some troubles running a threaded memcached with -P, see
https://bugs.gentoo.org/show_bug.cgi?id=195248 for details.

After looking at the source I noticed the writing of the pid happens
after the daemon starts it threads, resulting in multiple threads
wanting to write to the same file pointer. I've solved this with a patch

2672a2673
>       save_pid(getpid(), pid_file);
2721,2723c2722
<     /* save the PID in if we're a daemon */
<     if (daemonize)
<         save_pid(getpid(), pid_file);
---
>

Kind regards,

Marlon




More information about the memcached-commits mailing list