Module nextest_runner::double_spawn

source ·
Expand description

Support for double-spawning test processes.

Nextest has experimental support on Unix for spawning test processes twice, to enable better isolation and solve some thorny issues.

§Issues this currently solves

§posix_spawn SIGTSTP race

It’s been empirically observed that if nextest receives a SIGTSTP (Ctrl-Z) while it’s running, it can get completely stuck sometimes. This is due to a race between the child being spawned and it receiving a SIGTSTP signal.

For more details, see this message on the glibc-help mailing list.

To solve this issue, we do the following:

  1. In the main nextest runner process, using DoubleSpawnContext, block SIGTSTP in the current thread (using pthread_sigmask) before spawning the stub child cargo-nextest process.
  2. In the stub child process, unblock SIGTSTP.

With this approach, the race condition between posix_spawn and SIGTSTP no longer exists.

Structs§

  • Context to be used before spawning processes and dropped afterwards.
  • Information about double-spawning processes. This determines whether a process will be double-spawned.

Functions§