On Wed, Dec 8, 2010 at 11:23 AM, Davi Arnaut <davi.arnaut@stripped> wrote:
> Hi Tor,
>
>
> On 12/8/10 6:07 AM, Tor Didriksen wrote:
>
>> #At file:///export/home/didrik/repo/5.1-bugteam/ based on
>> revid:luis.soares@stripped
>>
>> 3513 Tor Didriksen 2010-11-26
>> Bug #58426 Crashing tests not failing as they are supposed to on
>> Solaris 10 debug
>>
>> On this platform we either
>> - get lots of other signals
>> - or maybe we lose the KILL signal
>>
>
> That's very strange, usually the only signals that can be lost are the real
> time ones as they are queued up.
yes, my guess is that we use ALARMs or sleep() in other threads, and those
interrupt the pause()
>
>
> Solution: loop with { kill; pause; } until process dies.
>>
>
> Some comments below.
>
>
> @ include/my_dbug.h
>> Let DBUG_SUICE loop forever until the KILL signal is delivered,
>> and process dies.
>>
>> modified:
>> include/my_dbug.h
>> === modified file 'include/my_dbug.h'
>> --- a/include/my_dbug.h 2010-10-18 11:24:34 +0000
>> +++ b/include/my_dbug.h 2010-11-26 14:04:06 +0000
>> @@ -24,6 +24,7 @@
>> #include<unistd.h>
>> #endif
>> #include<signal.h>
>> +#include <stdio.h>
>> #endif /* not __WIN__ */
>>
>> #if defined(__cplusplus)&& !defined(DBUG_OFF)
>> @@ -160,7 +161,18 @@ extern void _db_flush_();
>> #ifdef __WIN__
>> #define DBUG_SUICIDE() DBUG_ABORT()
>> #else
>> -#define DBUG_SUICIDE() (_db_flush_(), kill(getpid(), SIGKILL), pause())
>> +static inline void do_kill_and_pause_forever()
>>
>
> I suggest moving this function to dbug.c (_db_suicide). It allows for a
> possible better diagnostics if a thread ever hangs inside this function.
good point, introducing _db_suicide_() in dbug.cc
>
>
> +{
>> + fprintf(stderr, "SIGKILL myself\n");
>> + fflush(stderr);
>> + do
>> + {
>> + kill(getpid(), SIGKILL);
>>
>
> I think it would be nice to either check the return value or assert that
> the function succeeds. Otherwise, it could hang for quite a bit.
>
assert(kill_retval == 0) added
>
> + pause();
>>
>
> Perhaps sleep() would be better here? It has a similar behavior to pause()
> and we can use it to force the signal to be sent periodically.
sleep() did not make any difference, it was also interrupted.
actually the man page says
BUGS
sleep() may be implemented using SIGALRM; mixing calls to alarm(2)
and sleep() is a bad idea.
This, however, worked as expected:
sigset_t new_mask;
sigfillset(&new_mask);
sigsuspend(&new_mask);
the sigsuspend() never returned
What do you think, loop (kill, pause), or sigsuspend() ??
-- didrik
>
>
> + }
>> + while(1);
>> +}
>> +#define DBUG_SUICIDE() (_db_flush_(), do_kill_and_pause_forever())
>> #endif
>>
>>
> Regards,
>
> Davi
>
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:
> http://lists.mysql.com/commits?unsub=1
>
>