I don't know what is happening. Code is executing for 8-16 hours and then stops the execution of the program. Why? Can any one help on this?
Exception in thread "main" java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:133)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
at example.producer.Spout6.main(Spout6.java:79)
The exception typically indicates a network routing problem of some kind. This may be the result of a problem with the network configuration in you LAN or WAN, or it may be a result of a network link or switch outage. It can even be cause by failure of the host that you are trying to talk to.
IMO, it is unlikely to be a network firewall issue, though that is also possible. (Normally a firewall will simply discard packets to block traffic, and that is most likely to result in connection timeouts. However, a firewall could respond with an Destination Unreachable packet that would result in this exception.)
Could be a firewall... Or something like internet...Or too many ports...Here are the details:
Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.
Java docs
Also, you may be running out of available ports:
Another important ramification of the ephemeral port range is that it limits the maximum number of connections from one machine to a specific service on a remote machine! The TCP/IP protocol uses the connection's 4-tuple to distinguish between connections, so if the ephemeral port range is only 4000 ports wide, that means that there can only be 4000 unique connections from a client machine to a remote service at one time. (http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html)
Do this to get available ports to check:
$ cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000
Note:
It's certainly not a problem with the code, instead, try to keep a good connection by changing firewall settings, or getting stronger connection. Also, check the available ports by doing what I told you above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With