Commit 5dc121b
authored
Fix data races in the connection state changes tests (#7871)
The assignment to token1 on the main thread and the read of it on the sync
worker thread didn't have any intervening synchronization and in theory the
callback could read it before it's actually written. Fixing this requires
adding some locking.
Conversely, listener2 doesn't actually need to be atomic since the second
callback should only ever be invokved synchronously inside log_out(), and if
it's called at some other time that's a bug.
It doesn't matter here, but `listener1_call_cnt = listener1_call_cnt + 1` is a
nonatomic increment that will drop updates if it happens on multiple threads at
once, while `++` will not.1 parent 77ba427 commit 5dc121b
File tree
2 files changed
+10
-7
lines changed- test/object-store/sync/session
2 files changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
93 | 91 | | |
94 | 92 | | |
95 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
0 commit comments