Commit d64a56c
cluster: remove handles when disconnecting worker
Due to the race window between the master's "disconnect" message and the
worker's "handle received" message, connections sometimes got stuck in
the pending handles queue when calling `worker.disconnect()` in the
master process.
The observable effect from the client's perspective was a TCP or HTTP
connection that simply stalled. This commit fixes that by closing open
handles in the master when the "disconnect" message is sent.
Fixes: #3551
PR-URL: #3677
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent b48dbf9 commit d64a56cCopy full SHA for d64a56c
File tree
Expand file treeCollapse file tree
4 files changed
+96
-23
lines changedOpen diff view settings
Filter options
- lib
- internal
- test/parallel
Expand file treeCollapse file tree
4 files changed
+96
-23
lines changedOpen diff view settings
Collapse file
+26-23Lines changed: 26 additions & 23 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
217 | 217 | |
218 | 218 | |
219 | 219 | |
220 | | - |
| 220 | + |
221 | 221 | |
222 | 222 | |
223 | 223 | |
| ||
308 | 308 | |
309 | 309 | |
310 | 310 | |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
| 325 | + |
| 326 | + |
| 327 | + |
| 328 | + |
| 329 | + |
| 330 | + |
311 | 331 | |
312 | 332 | |
313 | 333 | |
| ||
319 | 339 | |
320 | 340 | |
321 | 341 | |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | | - |
339 | | - |
340 | | - |
341 | | - |
342 | 342 | |
343 | 343 | |
344 | 344 | |
| ||
404 | 404 | |
405 | 405 | |
406 | 406 | |
| 407 | + |
| 408 | + |
407 | 409 | |
408 | 410 | |
409 | 411 | |
| ||
490 | 492 | |
491 | 493 | |
492 | 494 | |
493 | | - |
| 495 | + |
| 496 | + |
494 | 497 | |
495 | 498 | |
496 | 499 | |
497 | | - |
| 500 | + |
498 | 501 | |
499 | 502 | |
500 | 503 | |
|
Collapse file
lib/internal/cluster.js
Copy file name to clipboard+4Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
Collapse file
+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
70 | 70 | |
71 | 71 | |
72 | 72 | |
| 73 | + |
73 | 74 | |
74 | 75 | |
75 | 76 | |
|
Collapse file
test/parallel/test-cluster-disconnect-handles.js
Copy file name to clipboard+65Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
0 commit comments