Bug 720890 - beakerd threads should log a traceback if they die
Summary: beakerd threads should log a traceback if they die
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: scheduler
Version: 0.6
Hardware: Unspecified
OS: Unspecified
high
unspecified vote
Target Milestone: ---
Assignee: Dan Callaghan
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-13 07:00 UTC by Dan Callaghan
Modified: 2019-05-22 13:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-28 23:50:16 UTC


Attachments (Terms of Use)

Description Dan Callaghan 2011-07-13 07:00:14 UTC
There is nothing supervising the various worker threads which run inside beakerd, so that if any of them dies due to an unhandled exception the traceback will be written to stderr (so, lost forever) and we will never know what went wrong.

Kobo has a decorator (kobo.decorators.log_traceback) which will write a traceback to a log file if an exception is raised out of the decorated function. We don't want to depend on kobo in Beaker server, but we could adapt the idea and write our own decorator for the beakerd worker threads.

Comment 1 Dan Callaghan 2011-07-14 00:47:07 UTC
Another interesting idea from Kobo is to override sys.excepthook (I didn't realise that was possible). See kobo.tback.set_except_hook. We already use this in lab controller code.

Unfortunately I don't think we can use sys.excepthook for beakerd's worker threads, since apparently it's not called for uncaught exceptions in threads [1].

[1] http://bugs.python.org/issue1230540

Comment 3 Raymond Mancy 2011-07-26 23:48:34 UTC
2011-07-26 19:36:06,287 beakerd ERROR Uncaught exception in new_recipes_loop
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bkr/server/util.py", line 140, in decorated
    func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bkr/server/tools/beakerd.py", line 603, in new_recipes_loop
    if not new_recipes():
  File "/usr/lib/python2.4/site-packages/bkr/server/tools/beakerd.py", line 79, in new_recipes
    raise Exception()
Exception


Note You need to log in before you can comment on or make changes to this bug.