reactive-grpc icon indicating copy to clipboard operation
reactive-grpc copied to clipboard

[reactor-grpc] Cancel signal should be ignored once Complete has been seen

Open ericbottard opened this issue 6 years ago • 7 comments

Per the reactive-streams spec items 1.6 and 3.7 combined, once a stream is complete, any cancel signal should be ignored.

This is not the case with reactor-grpc, which can have drastic effects as we saw in the following setup: Use of the groupBy() operator, which happens to cancel() in addition to regular complete(), on an rpc input Flux led to the cancellation of the output Flux as well, which is not intended.

ericbottard avatar Oct 01 '19 14:10 ericbottard

cc @OlegDokuka

bsideup avatar Oct 01 '19 14:10 bsideup

Thanks for the report @ericbottard. Would it be possible to provide a test case?

rmichela avatar Oct 01 '19 14:10 rmichela

Sadly I don't think I have a simple to reproduce test-case for you. You can have a look at the implementation in the linked PR above, but you may not be able to make much sense of it.

To reproduce simply, you'd need to rpc invoke a

Flux<O> fn(Flux<I> input)

function where:

  • the function continues to emit on its Flux<O> output after the input completes (or cancels, for that matter). It could for example disregard its input entirely and use Flux.interval()
  • have the Flux<I> input complete() AND cancel(), as is done for example by FluxGroupBy
  • this will freak out the gRPC machinery, which will cancel() the output stream as well.

ericbottard avatar Oct 01 '19 14:10 ericbottard

this will freak out the gRPC machinery

That can happen. While gRPC functions like a reactive stream most of the time, it does not comply with many of the rules of the reactive-streams spec, especially around stream cancellation.

rmichela avatar Oct 01 '19 15:10 rmichela

@ericbottard Were you able to find a work around, or is this issue a blocker for you?

rmichela avatar Oct 02 '19 17:10 rmichela

@rmichela We've got a workaround for now, namely bridging the reactive-grpc Flux with one that won't forward cancels after complete.

ericbottard avatar Oct 03 '19 07:10 ericbottard

Closing due to lack of repro.

rmichela avatar May 07 '20 14:05 rmichela