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

Dmytro Shkvyra commented on FLINK-3451:
---------------------------------------

[~uce] IMHO the problem is in {NetUtils.getAvailablePort()}. Letting 
{NettyServer} pick the port itself is not solution of problem, picked port can 
be also busy. We can solve problem for current JVM if use {synchronized} 
declaration for {NetUtils.getAvailablePort()} and get port randomly from some 
variants. It will prevent capture of same port number from different threads. 
Unfortunately, it can't prevent if same port number was captured from another 
process.
[~uce] What do you think? Is my solution acceptable for this issue.   If yes I 
would implement it.

> NettyServer port is determined via NetUtils.getAvailablePort()
> --------------------------------------------------------------
>
>                 Key: FLINK-3451
>                 URL: https://issues.apache.org/jira/browse/FLINK-3451
>             Project: Flink
>          Issue Type: Bug
>          Components: Distributed Coordination
>            Reporter: Ufuk Celebi
>
> During start up, the {{NettyServer}} port is configured via 
> {{NetUtils.getAvailablePort()}}. In most cases, this works as expected, but 
> it is possible that another service grabs the port while it is available 
> (between the check and {{NettyServer}} initialization).
> It is more robust to let {{NettyServer}} pick the port itself no port is 
> specified.
> In general the {{getAvailablePort-then-setConfig}} pattern is not recommended.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to