java.net.SocketException: Network is unreachable

JIRA | Igor Galić | 2 years ago
  1. 0

    puppet server's core components all assume that when they talk to the out-side world, they'll be talking IPv4 only. All of our internal machines are IPv6 only, so they resolve things like updates.puppetlabs.com and rubygems.org either directly to IPv6, or indirectly via DNS64 and NAT64. The first symptom of something being off is that puppetserver takes a long time to start up, and we only see in the debug log why: {code} 2015-02-26 17:26:46,048 DEBUG [p.s.v.version-check-core] Could not retrieve update information (http://updates.puppetlabs.com) java.net.SocketException: Network is unreachable at sun.nio.ch.Net.connect0(Native Method) ~[na:1.8.0_31] at sun.nio.ch.Net.connect(Net.java:457) ~[na:1.8.0_31] at sun.nio.ch.Net.connect(Net.java:449) ~[na:1.8.0_31] at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647) ~[na:1.8.0_31] at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:272) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:141) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348) ~[puppet-server-release.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31] {code} the second can be seen when trying to install a gem: {code} igalic@puppet01 ~ % sudo -H /usr/bin/puppetserver gem install hiera-file ERROR: Could not find a valid gem 'hiera-file' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SocketError: Network is unreachable (https://rubygems.org/latest_specs.4.8.gz) sudo -H /usr/bin/puppetserver gem install hiera-file 13,43s user 0,31s system 182% cpu 7,511 total igalic@puppet01 ~ % {code} i'd like to be able to tell puppetserver to prefer ipv6. putting that intent in the form of {{JAVA_ARGS="-Xms2g -Xmx2g -Djava.net.preferIPv6Addresses=true"}} into {{/etc/default/puppetserver}} doesn't seem to suffice: startup: {code} 2015-02-26 17:34:56,866 DEBUG [p.s.v.version-check-core] Could not retrieve update information (http://updates.puppetlabs.com) java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_31] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716) ~[na:1.8.0_31] at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:173) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:147) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:189) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.doExecute(CloseableHttpAsyncClientBase.java:67) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.access$000(CloseableHttpAsyncClientBase.java:38) ~[puppet-server-release.jar:na] at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:57) ~[puppet-server-release.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31] {code} gem: {code} igalic@puppet01 ~ % sudo -H /usr/bin/puppetserver gem install hiera-file ERROR: Could not find a valid gem 'hiera-file' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SocketError: Network is unreachable (https://rubygems.org/latest_specs.4.8.gz) sudo -H /usr/bin/puppetserver gem install hiera-file 13,97s user 0,33s system 187% cpu 7,637 total igalic@puppet01 ~ % {code}

    JIRA | 2 years ago | Igor Galić
    java.net.SocketException: Network is unreachable
  2. 0

    zookeeper unable to open socket to localhost/0:0:0:0:0:0:0:1:2181

    Stack Overflow | 2 years ago
    java.net.SocketException: Network is unreachable
  3. 0

    GitHub comment 85#65404836

    GitHub | 2 years ago | hadisotudeh
    java.net.SocketException: Network is unreachable
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 86#65792471

    GitHub | 2 years ago | hadisotudeh
    java.net.SocketException: Network is unreachable
  6. 0

    Logstash not connecting elasticsearch?

    Google Groups | 2 years ago | Siddharth Trikha
    java.net.SocketException: Network is unreachable

  1. RoiOtero 5311 times, last 1 week ago
  2. nasimk 7 times, last 5 months ago
  3. sriharshakiran 4 times, last 6 months ago
  4. RoiOtero 5635 times, last 5 months ago
8 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.SocketException

    Network is unreachable

    at sun.nio.ch.Net.connect0()
  2. Java RT
    SocketChannelImpl.connect
    1. sun.nio.ch.Net.connect0(Native Method)[na:1.8.0_31]
    2. sun.nio.ch.Net.connect(Net.java:457)[na:1.8.0_31]
    3. sun.nio.ch.Net.connect(Net.java:449)[na:1.8.0_31]
    4. sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647)[na:1.8.0_31]
    4 frames
  3. Apache HttpCore NIO
    AbstractMultiworkerIOReactor.execute
    1. org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:272)[puppet-server-release.jar:na]
    2. org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:141)[puppet-server-release.jar:na]
    3. org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348)[puppet-server-release.jar:na]
    3 frames
  4. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)[na:1.8.0_31]
    1 frame