Commit c100a62
wangjiahua.wjh
[ISSUE #10575] Fix race condition between scanResponseTable and processResponseCommand
processResponseCommand used get+remove (non-atomic) to retrieve ResponseFuture
from responseTable. scanResponseTable used iterator.remove(). If the response
arrived between scanResponseTable's remove and processResponseCommand's get,
the response would be logged as 'not matched any request' and silently dropped.
The callback would fire with timeout instead of success, even though the broker
had successfully processed the request.
Fix: Use ConcurrentHashMap.remove(key) in both methods. This is atomic:
either processResponseCommand gets the future (and executes success callback),
or scanResponseTable gets it (and executes timeout callback), but never both
and never neither.1 parent 8242c1e commit c100a62
1 file changed
Lines changed: 7 additions & 7 deletions
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
470 | | - | |
| 470 | + | |
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
475 | | - | |
476 | 474 | | |
477 | 475 | | |
478 | 476 | | |
| |||
564 | 562 | | |
565 | 563 | | |
566 | 564 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| |||
0 commit comments