mhammond / pywin32

Python for Windows (pywin32) Extensions
5.01k stars 792 forks source link

Prevent race condition in genpy via named mutex #2118

Open Chronial opened 1 year ago

Chronial commented 1 year ago

As described in its comment, #1601 did not fully fix the problems of #1600. It massively reduced the problem and the duration of the race condition, but did not remove it.

Opening many instances of the same com server in parallel can still cause exceptions in finish_writer. This is caused by two things:

The only proper solution for this issue I could think of is to use a named mutex to force mutual exclusion between all the operations that might interfere with each other. This solution is implemented in this PR.

Avasam commented 4 months ago

@Chronial your PR currently has conflicts

Chronial commented 4 months ago

👍 resolved