Re: [Sqlrelay-discussion] Forked listener removes unix socket file (patch available)
Brought to you by:
mused
From: Renat S. <sr...@st...> - 2011-11-14 14:08:50
|
Hello David, I've made patches for rudiments and sqlrelay to handle signals by flag. Please check it and tell what your thoughts are. 11.11.2011 09:50, David Muse пишет: > I applied the fix and it's in CVS now. > > You're right about signal handlers setting flags and the main app > testing for them and calling the shutdown code itself. That would > definitely eliminate race conditions, like a signal being received > before isforkedlistener is set but then the shutdown code testing > isforkedlistener. > > I have wondered about how to deal with problems like that before. I > can't believe the flag solution never occurred to me. It seems so > obvious now. Feel free to work on that :) > > Dave > > On 11/11/2011 12:09 AM, Renat Sabitov wrote: >> Yes, it might be a better solution. >> >> Yet, calling destructors and manipulating semaphores and shared memory >> in signal handler is not recommended at all. The best way to handle a >> signal is to fire some flag in the handler and then check it in the main >> program flow. >> >> 11.11.2011 02:39, David Muse пишет: >>> Ahhh, I see the problem... >>> >>> I think a cleaner solution might be to remove the setting of pidfile to >>> NULL after the fork() and just wrap the removal of the pid and unixport >>> files with an "if (!isforkedchild) {" in the destructor. Then the >>> semset, idmemory and cmdl objects would still be freed. >>> >>> What do you think? >>> >>> Dave > > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Sqlrelay-discussion mailing list > Sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion -- Renat Sabitov e-mail: sr...@st... Stack Soft jid: sr...@ja... |