grpc-web-devtools icon indicating copy to clipboard operation
grpc-web-devtools copied to clipboard

Calls to stream methods removeListener and cancel being ignored

Open friedemannf opened this issue 2 years ago • 5 comments

The current DevToolsStreamInterceptor implementation doesn't support calls to the stream's methods removeListener and cancel as calling these methods on the interceptor just does nothing. This leads to streams not being cancelled while the devtools are open.

friedemannf avatar Apr 11 '22 09:04 friedemannf

It looks like I stubbed these out deliberately, but can't recall why. -1 to myself for not leaving a comment.

jrapoport avatar Apr 26 '22 14:04 jrapoport

I do recall at the time the implementation for streaming wasn't fully baked. It's possible those calls caused problems back then that have since been resolved. I'd like to have a peek at the grpc library to see what's changed and if there are any obvious gotchas. Have you tested it out? Thanks!

jrapoport avatar Apr 26 '22 14:04 jrapoport

Thanks for your reply! Yes, we have a version of the devtools with this fix running in our team and it has fixed our imminent issue of cancel calls not going through. I'm not sure about removeListener though. If I should have a look at that or test anything else, let me know!

friedemannf avatar Apr 26 '22 18:04 friedemannf

Was the issue that if the cancel call does not propagate the stream won't cancel properly? Mainly I just want to look through the implementation of grpc to see if there's an obvious reason I omitted those calls. It's possible I just missed it.

jrapoport avatar Apr 26 '22 18:04 jrapoport

Yes exactly, we register a callback using stream.on('data', response => {...}) and after eventually calling stream.cancel() are continuing to receive calls to that callback as the stream isn't cancelled.

friedemannf avatar Apr 26 '22 18:04 friedemannf