Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/560#discussion_r101522786
  
    --- Diff: 
launcher/src/main/java/org/apache/brooklyn/launcher/BrooklynWebServer.java ---
    @@ -447,7 +450,15 @@ public synchronized void start() throws Exception {
             rootContext.setTempDirectory(Os.mkdirs(new File(webappTempDir, 
"war-root")));
     
             server.setHandler(handlers);
    -        server.start();
    +        try {
    +            server.start();
    +        } catch (BindException e) {
    +            // port discovery routines may take some time to clear, e.g. 
250ms for SO_TIMEOUT
    +            // tests fail because of this; see if adding a delay improves 
things
    +            log.warn("Initial server start-up failed binding (retrying 
after a delay): "+e);
    +            Time.sleep(Duration.millis(500));
    +            server.start();
    --- End diff --
    
    Another use case which would cause bind to fail is described in the 
comments of 
[isPortAvailable](https://github.com/apache/brooklyn-server/blob/master/utils/common/src/main/java/org/apache/brooklyn/util/net/Networking.java#L96-L98).
 Again the solution is to remove `SO_REUSEADDR`.
    Will prepare a PR which does the change - let's see if it will go well with 
the PR build.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to