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

ServerConnector leaks closed sockets which can lead to file descriptor exhaustion #5794

Closed
joewitt opened this issue Dec 10, 2020 · 1 comment
Assignees

Comments

@joewitt
Copy link
Contributor

joewitt commented Dec 10, 2020

Jetty version
9.4.35.v20201120 and older
Java version
OpenJDK Runtime Environment (build 1.8.0_272-b10) and others
OS type/version
OSX and Linux
Description
The ServerConnector class in openAcceptChannel creates a local variable which is an opened server socket channel. Then when attempting to bind to the specified port, if there is an exception, it will throw a new exception and not clean up the created channel/resource. The fix is to ensure that in the event of a bind exception the serverChannel is properly closed before throwing the exception back to the caller. Without this change the socket will be in a CLOSED state and a file descriptor held for it for the remainder of the life of the process.

joewitt added a commit to joewitt/jetty.project that referenced this issue Dec 11, 2020
…ailed bind to ensure proper resources are cleaned

Signed-off-by: Joe Witt <joewitt@apache.org>
joewitt added a commit to joewitt/jetty.project that referenced this issue Dec 11, 2020
…ailed bind to ensure proper resources are cleaned

Signed-off-by: Joe Witt <joewitt@apache.org>
@gregw gregw self-assigned this Dec 12, 2020
gregw added a commit that referenced this issue Dec 12, 2020
Fix #5794 Close socket on bind failure
gregw added a commit that referenced this issue Dec 12, 2020
Fix #5794 Close socket on bind failure
sbordet added a commit that referenced this issue Dec 14, 2020
Issue #5794 ensuring serverChannel is closed in the event of a failed bind to ensure proper resources are cleaned
gregw added a commit that referenced this issue Dec 14, 2020
Fix #5794 Close socket on bind failure
gregw added a commit that referenced this issue Dec 14, 2020
Update fix with IO.close()
gregw added a commit that referenced this issue Dec 14, 2020
* Fix #5794 Close socket on bind failure

Fix #5794 Close socket on bind failure

* Fix #5794 Close socket on bind failure

Fix #5794 Close socket on bind failure

* Fix #5794 Close socket on bind failure

Update fix with IO.close()
@gregw
Copy link
Contributor

gregw commented Dec 14, 2020

#5802 modified to be based on #5797 and both now merged. thanks @joewitt

@gregw gregw closed this as completed Dec 14, 2020
This was referenced Mar 10, 2021
This was referenced Mar 10, 2021
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

No branches or pull requests

2 participants