Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZOOKEEPER-3112: fix fd leak due to UnresolvedAddressException on conn… #592

Closed
wants to merge 2 commits into from

Conversation

PhantomThief
Copy link

…ect.

@anmolnar
Copy link
Contributor

anmolnar commented Aug 7, 2018

Nice catch @PhantomThief
Do you think writing a unit test would worth to cover the issue?

@PhantomThief
Copy link
Author

@anmolnar a bad news is, after my test case, it won't fix the fd leak...so I'm adding an another patch.

// if UnresolvedAddressException throw on connect and it would leak a SocketChannelImpl in cancelledKeys EVERY time.
// it's hard to deal all situations on socks.cancel,
// while an easy way is, ensure DNS resolve successful before register channel.
InetAddress.getByName(addr.getHostName());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help me understand why sock.close won't clean up the fd?

If we have to check before register, I would suggest to use explicit check here, like:

if (addr.isUnresolved()) {
    throw new UnresolvedAddressException();
}

@brandon-miles
Copy link

We were recently bitten by this. Is there any reason why the original commit was updated? It seemed like that was the right fix.

@maoling
Copy link
Member

maoling commented May 5, 2019

@PhantomThief
Can we move on ?

@PhantomThief
Copy link
Author

@PhantomThief
Can we move on ?

I'm sorry that this patch cannot resolve this problem. I'm trying to make another patch.

@anmolnar
Copy link
Contributor

Due to @PhantomThief 's comment, I'm closing this PR.

@anmolnar anmolnar closed this May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants