python-trio / python-trio/trio

Race condition in trio.hazmat.WaitForSingleObject

Open
#1,271 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

low-level Windows
Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

https://github.com/python-trio/trio/pull/575/files#diff-ed34813c30595dc83bb2a66e0973e22dR54

This appears to have a race condition. The new thread might start waiting only after the handle has been closed. This could be fixed by making the thread close the cancel_handle.

Originally posted by @GSPP in https://github.com/python-trio/trio/issues/233#issuecomment-546681264

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the change shown in pull request #575, especially the diff at line 54 for trio.hazmat.WaitForSingleObject. Trace how the new thread waits and how the handle and cancel_handle are closed; done means eliminating the race where waiting begins after the handle closes, with coverage for that ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.