Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

"Address already in use" error when elgalu/selenium container tries to start selenium-node-chrome #140

Closed
katryo opened this issue Jun 7, 2017 · 6 comments

Comments

@katryo
Copy link

katryo commented Jun 7, 2017

Hi.

I sometimes run into this problem and my tests stop working with Zalenium.

  1. I started Zalenium by docker-compose up -d with this docker-compose.yml
version: '2.1'

services:
  #--------------#
  zalenium_dev_or_prod:
    image: "dosel/zalenium"
    container_name: zalenium_dev_or_prod
    hostname: zalenium_dev_or_prod
    tty: true
    volumes:
      - /tmp/videos:/home/seluser/videos
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
    ports:
      - 4446:4444
      - 5555:5555
    command: >
      start --screenWidth 1930 --screenHeight 1090
            --timeZone "Asia/Tokyo"
            --videoRecordingEnabled true
            --sauceLabsEnabled false
            --browserStackEnabled false
            --testingBotEnabled false
            --startTunnel false
            --sendAnonymousUsageInfo false
  1. I ran five serial tests with the running Zalenium.
  2. Tests suddenly stopped.
  3. When I ran docker ps , I got this result.
CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS                        PORTS                                            NAMES
8ef5d4e283e8        elgalu/selenium:latest   "entry.sh"               42 seconds ago       Up 40 seconds (healthy)                                                        zalenium_dev_or_prod_40047
4517b155919c        elgalu/selenium:latest   "entry.sh"               About a minute ago   Up About a minute (healthy)                                                    zalenium_dev_or_prod_40045
949f3477a6d7        elgalu/selenium:latest   "entry.sh"               9 minutes ago        Up 9 minutes (unhealthy)                                                       zalenium_dev_or_prod_40041
58b31225aa22        elgalu/selenium:latest   "entry.sh"               3 hours ago          Up 3 hours (healthy)                                                           zalenium_dev_or_prod_40002
318d12d7382d        dosel/zalenium           "entry.sh start --..."   3 hours ago         Up 3 hours             0.0.0.0:5555->5555/tcp, 0.0.0.0:4446->4444/tcp   zalenium_dev_or_prod
  1. I logged in to the unhealthy container with this command.
 docker exec -i -t zalenium_dev_or_prod_40041 /bin/bash
  1. I found java.net.BindException: Address already in use on /var/log/cont/selenium-node-chrome-stderr.log .
seluser@zalenium_dev_or_prod:/var/log/cont$ cat selenium-node-chrome-stderr.log
18:40:34.262 INFO - Selenium build info: version: '3.3.1', revision: '5234b32'
18:40:34.273 INFO - Launching a Selenium Grid node
2017-06-07 18:40:37.921:INFO::main: Logging initialized @5194ms to org.seleniumhq.jetty9.util.log.StdErrLog
18:40:38.272 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
18:40:38.272 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
18:40:38.273 INFO - Driver class not found: com.opera.core.systems.OperaDriver
18:40:38.273 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
18:40:38.273 INFO - Driver class not found: com.opera.core.systems.OperaDriver
18:40:38.273 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
18:40:38.275 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
 registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
2017-06-07 18:40:38.507:INFO:osjs.Server:main: jetty-9.2.20.v20161216
2017-06-07 18:40:38.658:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@1d119efb{/,null,AVAILABLE}
java.lang.RuntimeException: java.net.BindException: Address already in use
        at org.openqa.selenium.remote.server.SeleniumServer.boot(SeleniumServer.java:149)
        at org.openqa.grid.internal.utils.SelfRegisteringRemote.startRemoteServer(SelfRegisteringRemote.java:128)
        at org.openqa.grid.selenium.GridLauncherV3$3.launch(GridLauncherV3.java:288)
        at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:99)
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.seleniumhq.jetty9.server.ServerConnector.open(ServerConnector.java:298)
        at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.java:236)
        at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.seleniumhq.jetty9.server.Server.doStart(Server.java:431)
        at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.openqa.selenium.remote.server.SeleniumServer.boot(SeleniumServer.java:147)
        ... 3 more
seluser@zalenium_dev_or_prod:/var/log/cont$

It might be Docker's bug.

I mentioned this problem at this comment. #116 (comment)

Docker version: 17.05.0-ce, build 89658be
Zalenium version: 3.3.1h
docker-selenium version: 3.3.1-p9

@elgalu elgalu changed the title "Address already in use" error happens when elugalu/selenium container tries to start selenium-node-chrome "Address already in use" error when elgalu/selenium container tries to start selenium-node-chrome Jun 7, 2017
@elgalu
Copy link
Member

elgalu commented Jun 7, 2017

Great error report @katryo .

@diemol will release a fix around this week.

@diemol
Copy link
Contributor

diemol commented Jun 8, 2017

Hi @katryo,

Can you please retest with the version we just released? 3.3.1i.

Thanks!

@katryo
Copy link
Author

katryo commented Jun 12, 2017

Thank you so much. I will retest it 👍

@diemol
Copy link
Contributor

diemol commented Jun 13, 2017

Hey @katryo,

I saw this exact same thing yesterday again, already after the release.

We don't really understand why this happens since the error means that the port is used in that docker-selenium container. @elgalu added some debug logs and I changed a parameter in Zalenium when creating the container to monitor that. In addition we are also adding a feature that will double check that the created container is actually up and working, otherwise we'll restart it or we'll create another.

This will be included in the next release.

@diemol
Copy link
Contributor

diemol commented Jun 20, 2017

Hi @katryo,

This issue has been addressed both in the latest Zalenium release and also in the latest docker-selenium release. https://github.com/elgalu/docker-selenium/releases/tag/3.3.1-p14
They check now when if those errors happen and retry the container creation.

Please pull the most recent images.

I'll close this issue for now but feel free to reopen in case you find something related.

Cheers,

@diemol diemol closed this as completed Jun 20, 2017
@katryo
Copy link
Author

katryo commented Jun 20, 2017

Thank you so much! I have been using Zalenium v3.3.1i for one week and I did not run into the "Address already in use" error. I guess this problem was solved, or at least the frequency of happening became less. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants