Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jun 21, 2019

This adds a test that creates two Flight clients to the same server, then closes one Flight client while the other still has an operation in progress, in order to ensure that gRPC doesn't share connections between the clients.

Copy link
Member

@BryanCutler BryanCutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking this out @lihalite ! The issue I was seeing was probably due to some grpc internals and I'm not sure of a better test to reproduce. Regardless, the fix here looks good and I think it makes things more consistent. I just had 2 minor comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you rename incomingAllocator -> allocator to be consistent with the the other classes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming this file to something a little more general, like "TestFlightClient.java"?

@ghost
Copy link
Author

ghost commented Jun 21, 2019

Thanks for taking a look, I made those two changes.

You may also tangentially appreciate #4652 for improved error handling in Flight/Java.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@be16de0). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #4648   +/-   ##
=========================================
  Coverage          ?   89.41%           
=========================================
  Files             ?      654           
  Lines             ?    93352           
  Branches          ?        0           
=========================================
  Hits              ?    83468           
  Misses            ?     9884           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be16de0...0f62556. Read the comment docs.

Copy link
Contributor

@jacques-n jacques-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore... Wrong pr

Copy link
Member

@BryanCutler BryanCutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BryanCutler
Copy link
Member

While you're here @jacques-n , any issue with this change?

@ghost
Copy link
Author

ghost commented Jun 21, 2019

Jacques commented on the JIRA https://issues.apache.org/jira/browse/ARROW-5063
Maybe we can back out the change to the allocator, but keep the test?

@BryanCutler
Copy link
Member

Comment from ARROW-5063:

I think we're trying to solve this wrong way. The idea that a client has its own allocator that is closed as it closes out to make sure it doesn't leak any memory is a good thing.

That is fine @jacques-n , the problem I had was when I called FlightClient.close() it also calls channel.shutdown() which seemed to break the grpc channel for other clients that were connected and caused a crash. I guess I'll have to try out my code again to see if it is still an issue, but I basically followed IntegrationTestClient that loops over locations and make a client for each

for (FlightEndpoint endpoint : info.getEndpoints()) {   
      List<Location> locations = endpoint.getLocations();
      for (Location location : locations) {
        FlightClient readClient = FlightClient.builder(allocator, location).build();
        ...
        // readClient.close()

Because of the error, I couldn't close the client and to check for leaks. That's why I thought it made more sense to not couple closing the allocator with closing the channel.

@jacques-n
Copy link
Contributor

jacques-n commented Jun 24, 2019 via email

@ghost
Copy link
Author

ghost commented Jun 24, 2019

It sounds like Bryan found that closing one client channel would close other client channels. This adds a simple unit test for that scenario, but we should do more investigation (probably the unit test can be made more robust to ensure that multiple clients are active at once).

AFAIK, some gRPC implementations do share channels internally; I believe C++ is one of them, but it also doesn't require you to close a channel explicitly.

@ghost
Copy link
Author

ghost commented Jun 24, 2019

Changed:

  • Revert changes to Flight client
  • More thoroughly test that closing one client doesn't affect an ongoing operation on another client

@BryanCutler
Copy link
Member

To confirm, the client caused another channel closure or closing the client triggered the server to close all channels?

From what I remember, multiple clients had the same location and seemed to share a channel. So closing one client, then trying to read from the next failed. I tried to debug what was going on with grpc internally but it was a bit confusing.. I'll try to reproduce the issue again and I'll open another JIRA if it still happens.

Copy link
Member

@BryanCutler BryanCutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks fine and I think we can merge it. @lihalite can you change the PR title/description to match the changes?

@ghost ghost changed the title ARROW-5063: [FlightRPC][Java] Don't create child allocator in FlightClient ARROW-5063: [FlightRPC][Java] Test that Flight client connections are independent Jun 24, 2019
@ghost
Copy link
Author

ghost commented Jun 24, 2019

@BryanCutler sure, updated.

@wesm
Copy link
Member

wesm commented Jun 24, 2019

Looks like this is failing due to checkstyle

@ghost
Copy link
Author

ghost commented Jun 25, 2019

This is now failing due to JPype, I can rebase once that's fixed.

@wesm
Copy link
Member

wesm commented Jun 25, 2019

I just posted a (temporary) fix for the jpype issue, will merge that once I have a passing build

@ghost
Copy link
Author

ghost commented Jun 26, 2019

Rebased, personal Travis: https://travis-ci.com/lihalite/arrow/builds/116983004

Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@wesm wesm closed this in 0466025 Jun 26, 2019
@wesm
Copy link
Member

wesm commented Jun 27, 2019

@lihalite I think this PR has a conflict with the application metadata patch

@BryanCutler
Copy link
Member

It looks like a quick fix, I'll post a PR

@emkornfield
Copy link
Contributor

emkornfield commented Jun 27, 2019 via email

@BryanCutler
Copy link
Member

Oops, I didn't see that. I'll close mine.

pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
… independent

This adds a test that creates two Flight clients to the same server, then closes one Flight client while the other still has an operation in progress, in order to ensure that gRPC doesn't share connections between the clients.

Author: David Li <[email protected]>

Closes apache#4648 from lihalite/arrow-5063 and squashes the following commits:

7002bc3 <David Li> Add test for independent Flight client shutdown in Java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants