[
https://issues.apache.org/jira/browse/ARROW-10441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223953#comment-17223953
]
David Li commented on ARROW-10441:
----------------------------------
Yes, FlightClient takes ownership of the associated channel. I'm not sure why
this is the case, but it does make using FlightClient slightly easier + Flight
by itself tries not to directly expose gRPC as there are hopes for alternate
transports in the future.
One workaround here would be to implement a proxy ManagedChannel that delegates
to the real channel but makes closing a no-op.
> [Java] Multiple FlightClients on a single channel can be closed accidentally
> ----------------------------------------------------------------------------
>
> Key: ARROW-10441
> URL: https://issues.apache.org/jira/browse/ARROW-10441
> Project: Apache Arrow
> Issue Type: Bug
> Components: Java
> Affects Versions: 2.0.0
> Reporter: Kyle Porter
> Priority: Minor
> Fix For: 2.0.1
>
>
> It seems there may be a mistake in the Java FlightClient where it's possible
> to create multiple FlightClients from a single ManagedChannel.
>
> See
> [https://github.com/apache/arrow/blob/master/java/flight/flight-grpc/src/main/java/org/apache/arrow/flight/FlightGrpcUtils.java#L55]
> which lets you specify the channel. However, if you do create multiple
> FlightClients from a single channel, then calling close()
> (https://github.com/apache/arrow/blob/master/java/flight/flight-core/src/main/java/org/apache/arrow/flight/FlightClient.java#L503)
> on a single FlightClient will close the channel for all of the FlightClients
> that share that channel, which seems incorrect.
>
> It's possible that the FlightGrpcUtils was intended only for testing purposes
> and this should never happen in practice. A few possible options would be to:
> * This behaviour is intended, no action.
> * Track if a channel is used by multiple clients and only close on the last
> client to close.
> * Disallow creation of a FlightClient with a specified ManagedChannel.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)