-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #5794 ensuring serverChannel is closed in the event of a failed bind to ensure proper resources are cleaned #5797
Conversation
…ailed bind to ensure proper resources are cleaned Signed-off-by: Joe Witt <joewitt@apache.org>
catch (IOException ioe) | ||
{ | ||
LOG.warn(ioe); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please rework this fix to use try-with-resources, so there is no need of an explicit close?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only want the serverChannel closed if the BindException occurs. Otherwise it needs to be returned to the caller in an open state. I don't believe try-with-resources is what we want here but let me know if I misunderstood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbordet try-with-resources doesn't work in this case as we use the socket in the successful case... actually probably should null out the field... just in case....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no fields were set, but there was one already in a try-with-resources, so backed the change out of that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the serverChannel is within the method scope so nothing to null out. I looked at the caller scope or otherwise to see if there was a better place to adjust the close (such as a try with resources). And I'm not seeing that. For the specific issue observed the change as I have it closes that problem. If this is part of a larger concern I'm not sure I follow. Do you need any change from the patch as-is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorporating this change within #5802.
catch (IOException ioe) | ||
{ | ||
LOG.warn(ioe); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I got confused and did #5802. Resolving now.... |
Issue #5794 ensuring serverChannel is closed in the event of a failed bind to ensure proper resources are cleaned
Signed-off-by: Joe Witt joewitt@apache.org