Commit cf92f2d
authored
xds: Prevent concurrent cancellations of data plane call in ExternalProcessorClientInterceptor (grpc#12996)
If the ext-proc stream terminates with a non-OK status, the interceptor
cancels the downstream data plane call (on the executor thread).
Concurrently, the application thread may call cancel() on the returned
proxy call (e.g. for user cancellation or cleanup).
Since ClientCallImpl does not synchronize its cancelCalled field,
concurrent cancellations from these two threads resulted in a TSAN data
race (that was discussed in
grpc#12975).
This commit introduces an AtomicBoolean downstreamCancelled in
DataPlaneClientCall to guard all downstream cancellations, ensuring that
only the first cancellation is forwarded to delayedCall/super.cancel().
This deduplicates and serializes cancellation handling from both the
application and the interceptor threads, preventing the data race.1 parent 0e8e0dd commit cf92f2d
1 file changed
Lines changed: 11 additions & 4 deletions
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
406 | | - | |
| 407 | + | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
| |||
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
593 | | - | |
| 594 | + | |
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
| |||
712 | 713 | | |
713 | 714 | | |
714 | 715 | | |
715 | | - | |
| 716 | + | |
716 | 717 | | |
717 | 718 | | |
718 | 719 | | |
| |||
899 | 900 | | |
900 | 901 | | |
901 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
902 | 909 | | |
903 | 910 | | |
904 | 911 | | |
| |||
910 | 917 | | |
911 | 918 | | |
912 | 919 | | |
913 | | - | |
| 920 | + | |
914 | 921 | | |
915 | 922 | | |
916 | 923 | | |
| |||
0 commit comments