]> Cypherpunks repositories - gostls13.git/commit
internal/poll: unlock read lock if write lock fails in readWriteLock
authorqmuntal <quimmuntal@gmail.com>
Fri, 30 Jan 2026 13:26:57 +0000 (14:26 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 4 Feb 2026 19:54:32 +0000 (11:54 -0800)
commit045d1270a7c299c6e40cccf3776860749abfe18e
treee54a9bafc9fd7381ab25e3707e6983762f820d90
parentbd1b41eb8131a503a1a8d2fc41d3e79bce159468
internal/poll: unlock read lock if write lock fails in readWriteLock

If the write lock acquisition fails, the read lock acquired earlier is
not released, leading to a potential deadlock.

The deadlock shouldn't occur because when the write lock fails, it
indicates that the FD is closing, and no other goroutine should be
holding the read lock. However, better to be safe and release the read
lock in such cases.

Change-Id: If593c36040a97357f835b42bb3133ff1dc55a638
Reviewed-on: https://go-review.googlesource.com/c/go/+/740560
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/internal/poll/fd_mutex.go