-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
PortInUseException thrown when Netty does not have the right to use configured port #19807
Comments
Good catch @zhangyangyu, here is the underlying exception
|
Hi team, I'm willing to fix this issue, but I found some problems. Netty doesn't expose the "permission denied" info through an Exception, it just throw the
Code from line 253. (https://github.com/netty/netty/blob/f17bfd0f64189d91302fbdd15103788bf9eabaa2/transport-native-unix-common/src/main/java/io/netty/channel/unix/Socket.java) And even the native error code (-13), is converted to just a String in the message. As linked by @snicoll. Do you think that a solution based on message "Permission Denied", is a good solution for now? |
@RicardoRFaria Which bit of the Netty code are you looking at? The exception @snicoll included is |
@philwebb The code that I linked before wasn't part of the problem. Sorry about that. |
Update classes that throw `PortInUseException` so that they also include the cause. Prior to this commit the cause was not included which could make diagnosing the real cause difficult. See gh-19807
@RicardoRFaria Thanks for offer to help but I wanted to push something before we release 2.3.0.RC so I've made an attempt myself. In the end I decided the safest way was to look at the error code inside the Netty exception. |
@philwebb No problem. It was nice to see your solution. |
Found this issue when trying to bind to an AWS machine's public IP - which doesn't actually exist as an interface on the machine, and thus failed with a fairly confusing "Port already in use" message. Great to see the message is being clarified. |
I am using Spring Boot 2.2.2.RELEASE and tries to bind my embbed netty server to port 443 with a non root user. The application fails to start with message:
Spend some time trying to find the process using port 443 but there is no. The real cause is that with no more system config it's not allowed for a non root user to use port under 1024. I think the
PortInUseException
is misleading here and a PermissionException is more suitable.The text was updated successfully, but these errors were encountered: