You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "bepec (via GitHub)" <gi...@apache.org> on 2023/11/10 14:51:54 UTC
[I] Proper way to intercept flight stream cancellation during FlightProducer::getStream() execution? [arrow]
bepec opened a new issue, #38668:
URL: https://github.com/apache/arrow/issues/38668
### Describe the usage question you have. Please include as many useful details as possible.
The Flight RPC API clearly suggests the possibility of cancelling incomplete flight stream by the client. There are few methods that seemingly should help to detect if the call was cancelled on server's side:
- CallContext::isCancelled()
- ServerStreamListener::isCancelled()
- ServerStreamListener::setOnCancelHandler()
I was trying to use all of these in FlightProducer::getStream() method implementation, but none of them did work. Polling functions always return false, and the cancel handler is only called upon leaving the getStream().
I made a test similar to [TestLeak.java](https://github.com/apache/arrow/blob/go/v14.0.0/java/flight/flight-core/src/test/java/org/apache/arrow/flight/TestLeak.java) - with the difference that I send data and call listener.completed() in getStream() body and not in cancel handler. Again, in this case the handler is only called after getStream() is completed - which doesn't make sense as getStream is called only once per ticket request.
We have a record batch producer implementation which can generate tons of data for single ticket, for hours.
It seems very reasonable to stop producing batches and release resources if client can't accept data anymore.
Is there any practical way we could do this with available Flight RPC implementation in Java?
### Component(s)
FlightRPC, Java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Proper way to intercept flight stream cancellation during FlightProducer::getStream() execution? [arrow]
Posted by "bepec (via GitHub)" <gi...@apache.org>.
bepec commented on issue #38668:
URL: https://github.com/apache/arrow/issues/38668#issuecomment-1822426199
Hi @jduo - thank you for suggestion, spawning another thread has never actually came to my mind. I will try that.
I noticed that the flight server spawns x2 threads per client already, and was expecting it to handle client state in a background; especially given that the isReady() polling directly from getStream() seems to work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Proper way to intercept flight stream cancellation during FlightProducer::getStream() execution? [arrow]
Posted by "jduo (via GitHub)" <gi...@apache.org>.
jduo commented on issue #38668:
URL: https://github.com/apache/arrow/issues/38668#issuecomment-1812873681
Hi @bepec , just wondering, does your getStream() implementation spawn another thread to do most of its work? If it doesn't and just uses the gRPC thread, the onCancelHandler() is never triggered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Proper way to intercept flight stream cancellation during FlightProducer::getStream() execution? [arrow]
Posted by "bepec (via GitHub)" <gi...@apache.org>.
bepec commented on issue #38668:
URL: https://github.com/apache/arrow/issues/38668#issuecomment-1822608603
Polling listener.isCancelled() appears to work when done from separate worker thread, thanks again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Proper way to intercept flight stream cancellation during FlightProducer::getStream() execution? [arrow]
Posted by "bepec (via GitHub)" <gi...@apache.org>.
bepec closed issue #38668: Proper way to intercept flight stream cancellation during FlightProducer::getStream() execution?
URL: https://github.com/apache/arrow/issues/38668
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org