mirror of
https://github.com/coder/coder.git
synced 2026-09-22 13:10:21 +08:00
fixes https://github.com/coder/internal/issues/1045 Fixes a race condition in our PG Coordinator when a peer disconnects. We issue database queries to find the peer mappings (node structures for each peer connected via a tunnel), and then send these to the "mapper" that generates diffs and eventually writes the update to the websocket. Before this change we erroneously used the querier's context for this update, which has the same lifetime as the coordinator itself. If the peer has disconnected, the mapper might not be reading from its channel, and this causes a deadlock in a querier worker. This also prevents us from doing any more work on the peer. I also added some more debug logging that would have been helpful when tracking this down.