Author vstinner
Recipients bkabrda, vstinner
Date 2014-04-02.09:56:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
"test_faulthandler.test_register_chain fails on some 64bit architectures (arm8, ppc64) with kernel >= 3.10"

I am a little bit surprised that the bug depends on the kernel version.

Does also crash with chain=False?

Can you check if HAVE_SIGACTION is defined in pyconfig.h? Or in Python: import sysconfig; print(sysconfig.get_config_var('HAVE_SIGACTION')).

Wit chain=True, faulthandler_register() registers its signal handler with SA_NODEFER flag:
    /* if the signal is received while the kernel is executing a system
       call, try to restart the system call instead of interrupting it and
       return EINTR. */
    action.sa_flags = SA_RESTART;
    if (chain) {
        /* do not prevent the signal from being received from within its
           own signal handler */
        action.sa_flags = SA_NODEFER;

With chain=True, the faulthandler_user() function calls the previous signal handler with:
    if (user->chain) {
        (void)sigaction(signum, &user->previous, NULL);
        errno = save_errno;

        /* call the previous signal handler */

        save_errno = errno;
        (void)faulthandler_register(signum, user->chain, NULL);
        errno = save_errno;
    if (user->chain) {
        errno = save_errno;
        /* call the previous signal handler */

You can try to add "#undef HAVE_SIGACTION" in faulthandler.c (after #include "Python.h") to see if the bug can be reproduced without sigaction. The code using signal() is very different, especially when chaining signal handlers.
Date User Action Args
2014-04-02 09:56:47vstinnersetrecipients: + vstinner, bkabrda
2014-04-02 09:56:47vstinnersetmessageid: <>
2014-04-02 09:56:47vstinnerlinkissue21131 messages
2014-04-02 09:56:47vstinnercreate