Skip to content

Bootstrap: Switch roles of fork parent and child? #1355

@moreati

Description

@moreati

Currently in first_stage()

  • the fork parent performs an exec() to a fresh Python interpreter
  • the fork child reads the preamble from Mitogen and writes it to the fresh interpreter.

If #1349 is merged then the fork child will also setup a SIGALRM failsafe switch, so that if a deadlock or other failure to read/write the preamble occurs then the processes will terminate. No hung processes should be left behind.

Problem

If the fork child is killed by the SIGALRM, then I expect the Python interpreter to exit with a 0 status. The non-zero exit status of the child will not be propagated, possibly masking this error condition.

Proposal

Switch the parent and child. Now the abnormal process termination may be able to propagate up the process tree to the Mitogen parent that ran it.

Open questions

  1. Is there a good reason it's not already done this way? Is the current arrangement necessary?
  2. If the roles are swapped will the exit status actually propagate in common scenarios (local vs ssh)?

refs #1305, #1349

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions