TanYuxin-tyx commented on pull request #17532:
URL: https://github.com/apache/flink/pull/17532#issuecomment-960498172
As shown above, I have reproduced the above exceptions. I added a new piece
of code to print this exception.
```java
System.out.println("e instanceof BindException? " + (e
instanceof BindException));
System.out.println("e.toString(): " + e.toString());
System.out.println("e.getLocalizedMessage(): " +
e.getLocalizedMessage());
System.out.println(
"e contains Address already in use? "
+ (ExceptionUtils.findThrowableWithMessage(
e, "Address already in use"))
.isPresent());
```
The test results are here.
https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=25907&view=logs&j=a57e0635-3fad-5b08-57c7-a4142d7d6fa9&t=2ef0effc-1da1-50e5-c2bd-aab434b1c5b7&l=6530
As the test results above, I found the `BindException` will be wrapped into
`NativeIoException`. The content of `NativeIoException` is 'Address already in
use'.

However, when running on the local Mac, the exception thrown by the same
code is `BindException`. This is a screenshot from my local IDEA test on Mac.

In my opinion, the exception thrown initially is `BindException`, but when
running the test on the test platform, it is wrapped as `NativeIoException`.
So I think catch both `BindException` and exceptions with 'Address already
in use' are necessary.
WDYT?, @guoweiM, @wsry. Thanks again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]