[ 
https://issues.apache.org/jira/browse/CAMEL-13853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16905474#comment-16905474
 ] 

Jan Bednar commented on CAMEL-13853:
------------------------------------

In current implementation the real issue is calling to _Socket#setReuseAddress_ 
after bind (call to bind is implicit in ServerSocket(int) constructor). The 
javadoc says the behavior of this is not defined - In full Linux, is this 
setter simply ignored, but in WSL this throws  _java.net.SocketException: 
Invalid argument._ . Because this exception is subtype of IOException, the 
method tries all ports untill exhausted.

Completely agree with ServerSocket(0) approach. I was thinking about the same. 
This will remove the startPort feature, but I really dont see much usefullnes 
in this for unit tests and the performance overhead of actual approach is huge. 
It is much better to delegate this work to OS.

> camel-test AvailablePortFinder fails on WSL for Windows 10
> ----------------------------------------------------------
>
>                 Key: CAMEL-13853
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13853
>             Project: Camel
>          Issue Type: Improvement
>          Components: tests
>         Environment: WSL: OpenJDK 1.8.0_212 and OpenJDK 11.0.4
>            Reporter: Jan Bednar
>            Assignee: Jan Bednar
>            Priority: Minor
>         Attachments: console.log, hs_err_pid9023.log, replay_pid9023.log
>
>
> On WSL with Ubuntu 16.04.6 LTS method getNextAvailable iterates all ports and 
> then crashes JVM (logs in attachments).
> This can be reproduced by running AvailablePortFinderTest on one of these 
> platforms.
> We can take a look to other implementations, if they performs better and are 
> usable on all supported OS.
> //Edit: Removed W10 from environments, as I cannot reproduce it again. On WSL 
> it is reproducible always.
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to