Author gpolo
Recipients georg.brandl, gpolo, loewis, schmir
Date 2008-04-07.23:28:36
SpamBayes Score 0.161398
Marked as misclassified No
Message-id <1207610918.62.0.252806111687.issue2240@psf.upfronthosting.co.za>
In-reply-to
Content
Trent Nelson kindly gave me access to his FreeBSD 6.2 buildbot so I had
chance to do some tests. The problem happens when Python is built
against or libc_r, or if you are using libmap you won't need to
recompile but the problem still happens when using libc_r.

I started searching in the FreeBSD bug tracker and found this issue:
http://www.freebsd.org/cgi/query-pr.cgi?pr=threads/49087 which seems
very similar to the problem related here.

I've also done a very simple "test" in C, just to demonstrate that this
issue isn't related to Python at all:

#include <stdio.h>
#include <signal.h>
#include <sys/time.h>

void h(int signo)
{
    struct itimerval t;

    getitimer(ITIMER_PROF, &t);
    printf("%d %d\n", t.it_value.tv_sec, t.it_value.tv_usec);

    printf("deactive ITIMER_PROF\n");
    t.it_value.tv_sec = 0;
    t.it_value.tv_usec = 0;
    setitimer(ITIMER_PROF, &t, &t);
}

int main(void)
{
    struct itimerval ival;

    ival.it_value.tv_sec = 1;
    ival.it_value.tv_usec = 0;
    ival.it_interval.tv_sec = 1;
    ival.it_interval.tv_usec = 0;

    signal(SIGPROF, h);
    printf("%d\n", setitimer(ITIMER_PROF, &ival, NULL));
    alarm(2);

    while (1) {
        getitimer(ITIMER_PROF, &ival);
        if (ival.it_value.tv_sec == 0 && ival.it_value.tv_usec == 0)
            break;
        }

    return 0;
}

When I compile this using -lc_r then the callback "h" is never called
and then the alarm is fired. Compiling against pthread, thr or nothing
(since this example doesn't need any threading library) doesn't
demonstrate this problem and all is fine (callback "h" is invoked,
infinite loop finishes and test returns 0).

Should further discussion be moved to python-dev ? I'm somewhat stuck on
how to resolve this, besides saying to upgrade to FreeBSD 7 which uses
libthr by default.
History
Date User Action Args
2008-04-07 23:28:39gpolosetspambayes_score: 0.161398 -> 0.161398
recipients: + gpolo, loewis, georg.brandl, schmir
2008-04-07 23:28:38gpolosetspambayes_score: 0.161398 -> 0.161398
messageid: <1207610918.62.0.252806111687.issue2240@psf.upfronthosting.co.za>
2008-04-07 23:28:37gpololinkissue2240 messages
2008-04-07 23:28:36gpolocreate