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.
> 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.
> +{
> + 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.
> + 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.
> + }
> + while(1);
> +}
> +#define DBUG_SUICIDE() (_db_flush_(), do_kill_and_pause_forever())
> #endif
>
Regards,
Davi