Project

General

Profile

Bug #4436

Race in TERM handling in glideFactoryEntryGroup

Added by Burt Holzman over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Factory
Target version:
Start date:
07/26/2013
Due date:
% Done:

0%

Estimated time:
First Occurred:
Stakeholders:
Duration:

Description

We have problems if another SIGTERM arrives when we're handling the first. From my e-mail:

if pid != 0:
  os.close(w)
  pipe_ids[entry.name] = {'r': r, 'pid': pid}
else:
  os.close(r)
  try:
      work_done = glideFactoryEntry.check_and_perform_work(...)
      return_dict = compile_pickle_data(...)
      os.write(w, ...)
  except Exception, ex:
      tb = traceback.format_exception(...)
      entry.logFiles.logDebug(...)
      os.close(w)
      os.kill(os.getpid(),signal.SIGKILL)

We install a signal handler. When a SIGTERM is received, it throws a KeyboardException.  It looks to me that two SIGTERMs were received by the child process -- one of them got caught by the except clause above, but the second one was received during the tb = traceback.format_exception line.  It then raised a new KeyboardException which got caught hire up in code that should only be run by the parent.

These async exceptions are tough to get right. I propose to de-register the signal handler for the code block above and re-register it just for the parent.  The sigterm will kill the child, but I think that's ok. 

History

#1 Updated by Burt Holzman over 7 years ago

  • Category changed from Factory & Frontend Monitoring to Factory

#2 Updated by Burt Holzman over 7 years ago

  • Status changed from Assigned to Feedback
  • Assignee changed from Burt Holzman to Parag Mhashilkar

#3 Updated by Parag Mhashilkar over 7 years ago

  • Assignee changed from Parag Mhashilkar to Burt Holzman

Changes look ok. Merged the changes in branch_v2plus and master

#4 Updated by Parag Mhashilkar over 7 years ago

  • Status changed from Feedback to Closed

Changes look ok. Merged the changes in branch_v2plus and master

Also available in: Atom PDF