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'. 
   
![image](https://user-images.githubusercontent.com/20889547/140267454-f2819d1b-82ba-4f19-8a51-cd09a375e41a.png)
   
   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. 
   
![image](https://user-images.githubusercontent.com/20889547/140268119-e7bad038-92a9-449c-8288-9850276b98d9.png)
   
   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]


Reply via email to