This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Add signal handler on main thread - by doing it at module load time.
ClosedPublic

Authored by kristof.beyls on Feb 22 2016, 8:21 AM.

Details

Reviewers
cmatthews
Summary

We've seen tracebacks like the one below on our LNT server, indicating
that previously, the code that adds the signal handler could be executed
by a thread that's not the main thread. Fix this by installing the
signal handler at module load time, which is assumed to always run in
the main thread.

File "/lnt/lnt/server/ui/views.py", line 124, in submit_run
  current_app.old_config, g.db_name, db, path, '<auto>', commit)
File "/lnt/lnt/util/ImportData.py", line 120, in import_and_report
  async_ops.async_fieldchange_calc(db_name, ts, run)
File "/lnt/lnt/util/async_ops.py", line 66, in async_fieldchange_calc
  func_args)
File "/lnt/lnt/util/async_ops.py", line 90, in async_run_job
  launch_workers()
File "/lnt/lnt/util/async_ops.py", line 47, in launch_workers
  signal.signal(signal.SIGTERM, sigHandler)

ValueError: signal only works in main thread

Diff Detail

Event Timeline

kristof.beyls retitled this revision from to [LNT] Add signal handler on main thread - by doing it at module load time..
kristof.beyls updated this object.
kristof.beyls added a reviewer: cmatthews.
kristof.beyls added a subscriber: llvm-commits.
cmatthews accepted this revision.Mar 7 2016, 5:53 PM
cmatthews edited edge metadata.

LGTM. Thanks!

This revision is now accepted and ready to land.Mar 7 2016, 5:53 PM
kristof.beyls closed this revision.Mar 14 2016, 6:27 AM

Committed as r263416