Parallel test runner deadlocks on concurrent runs
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- distributed-systems, testing
Research direction
Start by locating the parallel test runner and reading its current Boost.Interprocess queue and named mutex handling; the issue does not name specific files or tests. Then trace how the parent and worker processes coordinate, and identify the existing runner tests or commands. Done means concurrent runs work, worker crashes and interrupted runs do not leave stuck state, and remaining tests are reported as aborted when workers fail.
Written by the indexing model from the issue text.
Description
The parallel test runner currently uses 3 global named Boost.Interprocess queues and a named mutex. This means that
- It's not possible to run more than one at a time, even from different checkouts.
- A crashed worker process deadlocks the run.
- An interrupted run (crash, Ctrl-C, killed in a debugger) leaves the global objects around.
Proposed solution: move all state management into the parent process and have worker processes talk to it via sockets on localhost:
- Parent listens on a random free port on localhost. It passes the port number to workers as a command-line argument. It also generates a random token and passes it to workers as an environment variable.
- Each worker connects with a handshake and the token. Parent ignores connections without the right token.
- Parent processes all requests from workers in one thread using Boost.Asio. All state is kept in the parent process and accessed from this thread. No locks and no global objects needed.
Pros:
- Supports any number of concurrent runs.
- No global system-wide objects. Crashed/interrupted runs don't leave orphaned global objects.
- Robust against crashes in workers. If a worker crashes, the test it was running is reported as aborted. The other workers carry on. If all workers die, the remaining tests are reported as aborted as well, and the run ends.
- Arguably simpler code with no locks. No dependency on Boost.Interprocess and librt.
Cons:
- Requires a loopback interface. This is present basically everywhere, even build sandboxes, but it is possible to make containers without it.
- We should probably bump the minimum Boost version for the parallel test runner to 1.69. It already does not really work with lower versions (see #2429), but there are even more asio related changes between 1.58 and 1.69.
@lballabio what do you think?
- Dominant language
- C++
- Stars
- 7.7k
- Forks
- 2.3k
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 100
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lballabio/QuantLib
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
lballabio/QuantLib#3134 · 1 comment ·
Maintainers usually reply within 3 days
-
BiCGstab discards a converged solution when convergence lands on the last permitted iterationPossibly taken @Rahul19771 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Solver1D tests: Probe in test-suite/solvers.cpp has the wrong derivative signPossibly taken @igitur claimed this 6 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 35/100
lballabio/QuantLib#3114 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
lballabio/QuantLib#3106 · 2 comments ·
Maintainers usually reply within 3 days
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
lballabio/QuantLib#3105 · 1 comment ·
Maintainers usually reply within 3 days
All issues in lballabio/QuantLib
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
patrick-hudson/put.gd-desktop#2044 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
uxlfoundation/oneDNN#6604 · 1 comment ·
Maintainers usually reply within 2 days