- Notifications
You must be signed in to change notification settings - Fork1.1k
Commit05b037b
authored
fix: avoid deadlock race writing to a disconnected mapper (#20303)
fixescoder/internal#1045Fixes 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.1 parent3699ff6 commit05b037b
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
873 | 873 | | |
874 | 874 | | |
875 | 875 | | |
| 876 | + | |
876 | 877 | | |
877 | 878 | | |
878 | 879 | | |
| 880 | + | |
879 | 881 | | |
880 | 882 | | |
881 | 883 | | |
| |||
902 | 904 | | |
903 | 905 | | |
904 | 906 | | |
905 | | - | |
| 907 | + | |
| 908 | + | |
906 | 909 | | |
907 | 910 | | |
908 | 911 | | |
| |||
913 | 916 | | |
914 | 917 | | |
915 | 918 | | |
| 919 | + | |
916 | 920 | | |
917 | 921 | | |
918 | 922 | | |
| |||
940 | 944 | | |
941 | 945 | | |
942 | 946 | | |
943 | | - | |
| 947 | + | |
944 | 948 | | |
945 | 949 | | |
946 | 950 | | |
947 | 951 | | |
| 952 | + | |
948 | 953 | | |
949 | 954 | | |
950 | 955 | | |
| |||
1019 | 1024 | | |
1020 | 1025 | | |
1021 | 1026 | | |
1022 | | - | |
| 1027 | + | |
1023 | 1028 | | |
1024 | 1029 | | |
1025 | 1030 | | |
| |||
0 commit comments
Comments
(0)