This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: regrtest: register SIGALRM signal using faulthandler
Type: crash Stage:
Components: Tests Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, python-dev, vstinner
Priority: normal Keywords:

Created on 2011-07-13 10:14 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg140243 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-07-13 10:14
Sometimes, some tests are stopped because of SIGALRM. A recent example:
-----------------------
[157/357] test_socketserver
Alarm clock
*** Error code 142
-----------------------
http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%206.4%203.x/builds/1647/steps/test/logs/stdio

faulthandler is able to dump the Python backtrace in such case, we just have to register the SIGALRM signal handler. regrtest should be patched: just add faulthandler.register(signal.SIGALRM).

It would be nice if faulthandler calls the previous signal handler. By default, it replaces the existing signal handler and so it changes the behaviour.

A test should also be added to faulthandler for SIGALRM, this signal is special because of its default signal handler (it exits the process).
msg140309 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-13 21:40
New changeset 39873557ff4f by Victor Stinner in branch 'default':
Issue #12550: Add chain optional argument to faulthandler.register()
http://hg.python.org/cpython/rev/39873557ff4f
msg140310 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-13 21:49
New changeset 30f91fbfc8b3 by Victor Stinner in branch 'default':
Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
http://hg.python.org/cpython/rev/30f91fbfc8b3
msg140319 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-07-14 00:37
My patch doesn't work: the traceback is not printed:
--------------------------
$ ./python -m test -v -u network -F test_threadsignals
(...)
[106] test_socketserver
(...)
test_UnixStreamServer (test.test_socketserver.SocketServerTest) ... creating server
ADDR = /tmp/unix_socket.wuwy8y
CLASS = <class 'socketserver.UnixStreamServer'>
server running
test client 0
test client 1
test client 2
waiting for server
done
ok
test_shutdown (test.test_socketserver.SocketServerTest) ... Alarm clock: 14
--------------------------

SocketServerTest uses a timeout of 20 seconds implemented using signal.alarm(). I suppose that the timeout is too small for this very slow buildbot.
msg140333 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-07-14 13:42
Oops, I specified the wrong issue number if the commits:

New changeset d3cebbd500aa by Victor Stinner in branch '2.7':
Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20
http://hg.python.org/cpython/rev/d3cebbd500aa

New changeset 05dfed82457a by Victor Stinner in branch '3.2':
Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20
http://hg.python.org/cpython/rev/05dfed82457a

New changeset a609b2a44f92 by Victor Stinner in branch 'default':
(merge 3.2) Issue #12250: test_socketserver uses a timeout of 60 seconds
http://hg.python.org/cpython/rev/a609b2a44f92
msg140335 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-07-14 14:02
Can this be closed?
msg140368 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-07-14 19:05
> Can this be closed?

I think (hope) that the initial issue (test_socketserver) failure is fixed, thanks to my second commit.

I'm not complelty satisfied because the traceback was not printed on a SIGALRM when i tried -m test -F test_socketserver. But if I raise manually the signal, using signal.alarm(10) for example, the traceback was printed on FreeBSD 6.4 and let close this issue.
History
Date User Action Args
2022-04-11 14:57:19adminsetgithub: 56759
2011-07-14 19:05:42vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg140368
2011-07-14 14:02:44georg.brandlsetnosy: + georg.brandl
messages: + msg140335
2011-07-14 13:42:53vstinnersetmessages: + msg140333
2011-07-14 00:37:21vstinnersetmessages: + msg140319
2011-07-13 21:49:43python-devsetmessages: + msg140310
2011-07-13 21:40:29python-devsetnosy: + python-dev
messages: + msg140309
2011-07-13 10:14:11vstinnercreate