java.net.BindException: Failed to listen on port 10000 because it's already in use.

Jenkins JIRA | Vincent Latombe | 1 year ago
  1. 0

    When using a init.groovy.d script to set the slave agent port to a fixed value (like the [official docker image|https://github.com/jenkinsci/docker/blob/master/init.groovy] for Jenkins does), Jenkins shows an error message that seem to tell us that it failed to listen to the agent port. {quote} java.net.BindException: Failed to listen on port 10000 because it's already in use. at hudson.TcpSlaveAgentListener.<init>(TcpSlaveAgentListener.java:74) at jenkins.model.Jenkins.<init>(Jenkins.java:825) at hudson.model.Hudson.<init>(Hudson.java:83) at hudson.model.Hudson.<init>(Hudson.java:79) at hudson.WebAppMain$3.run(WebAppMain.java:225) 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:436) at sun.nio.ch.Net.bind(Net.java:428) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67) at hudson.TcpSlaveAgentListener.<init>(TcpSlaveAgentListener.java:72) ... 4 more {quote} As a workaround, people have been adding delays, but really the issue is that we have the following sequence of events occurring : - Jenkins init - init.groovy.d -* calls Jenkins.getInstance(). setSlaveAgentPort(xxx) -** behind the scenes, this call starts the TcpSlaveAgentListener - initializes TcpSlaveAgentListener, but doesn't suppose that it may have been started before => the port is already taken, hence the error message above.

    Jenkins JIRA | 1 year ago | Vincent Latombe
    java.net.BindException: Failed to listen on port 10000 because it's already in use.
  2. 0

    When using a init.groovy.d script to set the slave agent port to a fixed value (like the [official docker image|https://github.com/jenkinsci/docker/blob/master/init.groovy] for Jenkins does), Jenkins shows an error message that seem to tell us that it failed to listen to the agent port. {quote} java.net.BindException: Failed to listen on port 10000 because it's already in use. at hudson.TcpSlaveAgentListener.<init>(TcpSlaveAgentListener.java:74) at jenkins.model.Jenkins.<init>(Jenkins.java:825) at hudson.model.Hudson.<init>(Hudson.java:83) at hudson.model.Hudson.<init>(Hudson.java:79) at hudson.WebAppMain$3.run(WebAppMain.java:225) 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:436) at sun.nio.ch.Net.bind(Net.java:428) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67) at hudson.TcpSlaveAgentListener.<init>(TcpSlaveAgentListener.java:72) ... 4 more {quote} As a workaround, people have been adding delays, but really the issue is that we have the following sequence of events occurring : - Jenkins init - init.groovy.d -* calls Jenkins.getInstance(). setSlaveAgentPort(xxx) -** behind the scenes, this call starts the TcpSlaveAgentListener - initializes TcpSlaveAgentListener, but doesn't suppose that it may have been started before => the port is already taken, hence the error message above.

    Jenkins JIRA | 1 year ago | Vincent Latombe
    java.net.BindException: Failed to listen on port 10000 because it's already in use.
  3. 0

    Add some troubleshooting docs?

    GitHub | 2 years ago | mtscout6
    java.net.BindException: Failed to listen on port 50000 because it's already in use.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Failed to listen to incoming slave connection

    GitHub | 2 years ago | jgillich
    java.net.BindException: Failed to listen on port 50000 because it's already in use.
  6. 0

    WildFly error: Could not start http listener despite no port occupation

    sourcecodebig.com | 12 months ago
    jboss.undertow.listener.default: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: Could not start http listener

  1. musketyr 1 times, last 7 days ago
  2. johnxfly 1 times, last 1 week ago
  3. kjhdofjosvs 1 times, last 2 weeks ago
  4. rlovtangen 2 times, last 1 week ago
  5. Nikolay Rybak 1 times, last 1 month ago
40 more registered users
55 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.net.BindException

    Address already in use

    at sun.nio.ch.Net.bind0()
  2. Java RT
    ServerSocketAdaptor.bind
    1. sun.nio.ch.Net.bind0(Native Method)
    2. sun.nio.ch.Net.bind(Net.java:436)
    3. sun.nio.ch.Net.bind(Net.java:428)
    4. sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
    5. sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    6. sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
    6 frames
  3. Hudson
    TcpSlaveAgentListener.<init>
    1. hudson.TcpSlaveAgentListener.<init>(TcpSlaveAgentListener.java:72)
    1 frame
  4. jenkins.model
    Jenkins.<init>
    1. jenkins.model.Jenkins.<init>(Jenkins.java:825)
    1 frame
  5. Hudson
    WebAppMain$3.run
    1. hudson.model.Hudson.<init>(Hudson.java:83)
    2. hudson.model.Hudson.<init>(Hudson.java:79)
    3. hudson.WebAppMain$3.run(WebAppMain.java:225)
    3 frames