sync: RWMutex can deadlock when readers queue behind a writer
Concurrent process and pipe creation stopped in my CLI tests. Both use syscall.ForkLock, which is a sync.RWMutex.
A reader holds the lock. A writer waits, then another reader queues. When the first reader unlocks, the writer can remain blocked. A second failure can lose a reader wakeup during lock handover.
On 2 September 2026, the tests in #5630 reproduced this with TinyGo v0.42.0 on Linux/arm64 and Darwin/arm64. TestRWMutexWriterNotStarvedByLateReaders failed after 10 seconds. The lock should let the waiting writer and readers finish.
Regression tests are in #5630. Copy them into src/sync and run tinygo test -run TestRWMutex sync.
Source checked on 18 September 2026. The affected code is unchanged in dev at 93940cb6. #5630 was closed on 17 September with a request for this issue.
Replacement draft PR #5697.
Source: tinygo-org/tinygo