Re: [Sqlrelay-discussion] Forked listener removes unix socket file (patch available)
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2011-11-14 17:29:40
|
Wow, that was fast! Thanks, I'll check them out and let you know soon.
Dave
On 11/14/2011 09:08 AM, Renat Sabitov wrote:
> 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
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
>
> _______________________________________________________
> Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
> http://www.doteasy.com
>
>
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
>
> _______________________________________________________
> Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
> http://www.doteasy.com
|