Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception caught in class ZombieHandler java.net.SocketException: Network is unreachable #6

Closed
jacy opened this issue Jun 21, 2012 · 11 comments

Comments

@jacy
Copy link

jacy commented Jun 21, 2012

when I excuted the main method of ZombieClient in example-games project,I got lots of exceptions like this:

Exception caught in class ZombieHandler
java.net.SocketException: Network is unreachable

@menacher
Copy link
Owner

I will take a look. Could you paste entire stack trace?

@menacher
Copy link
Owner

Did you start the game server at src/main/java/org.menacheri.GameServer?

Also remember to provide Log4j Configuration in VM startup parameters of eclipse "Run Configurations". The following VM flag needs to be set there -Dlog4j.configuration=GameServerLog4j.properties
If you can provide logs of what happened then that would also be helpful.

By the way there is another client at src/test/java/org.menacheri.zombieclient.ZombieJetClient. You could try running that one and see whether it connects.

@jacy
Copy link
Author

jacy commented Jun 22, 2012

I did start the game server located in src/main/java/org.menacheri.GameServer,and Log4j Configuration was configuared correctly. The exception details:

Started: 28
UDP address for connect UDP: 127.0.0.1/127.0.0.1:61750
Going to connect UDP in ZombieHandler
java.net.SocketException: Network is unreachable
at sun.nio.ch.DatagramChannelImpl.send0(Native Method)
at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:304)
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:269)
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:254)
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$PooledSendBuffer.transferTo(SocketSendBufferPool.java:239)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.write0(NioDatagramWorker.java:540)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.writeFromTaskLoop(NioDatagramWorker.java:462)
at org.jboss.netty.channel.socket.nio.NioDatagramChannel$WriteTask.run(NioDatagramChannel.java:317)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.processWriteTaskQueue(NioDatagramWorker.java:330)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.run(NioDatagramWorker.java:254)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

and also some exception like this:

Exception caught in class DefenderHandler
Recieved eventType: 11

Exception caught in class DefenderHandlerjava.util.concurrent.RejectedExecutionException
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:215)
at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:426)
at java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:657)
at org.menacheri.zombie.DefenderHandler.messageReceived(DefenderHandler.java:39)
at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:69)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:71)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:327)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:305)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:207)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)

at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274)Started: 40

Recieved eventType: 11
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194)
Recieved eventType: 24
Started: 41

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Exception caught in class DefenderHandler

@menacher
Copy link
Owner

Thanks, I will take a look. The latest code is working fine for me locally, So maybe it could be a UDP related env problem also. Did you try out the ZombieJetClient class. Did that work?

@jacy
Copy link
Author

jacy commented Jun 22, 2012

oops,I had tried ZombieJetClient,but I got totally exceptions like this:

Session is already shutting down. Disconnect event will be discarded for channel {}760370133
Received exception event in session. Going to close session
2012-6-22 13:47:59 org.jboss.netty.channel.DefaultChannelFuture
warn: An exception was thrown by ChannelFutureListener.
java.lang.RuntimeException: java.net.SocketException: Network is unreachable
at org.menacheri.jetclient.NettyUDPClient$2.operationComplete(NettyUDPClient.java:263)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:397)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:383)
at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:350)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.write0(NioDatagramWorker.java:575)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.writeFromTaskLoop(NioDatagramWorker.java:462)
at org.jboss.netty.channel.socket.nio.NioDatagramChannel$WriteTask.run(NioDatagramChannel.java:317)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.processWriteTaskQueue(NioDatagramWorker.java:330)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.run(NioDatagramWorker.java:254)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.net.SocketException: Network is unreachable
at sun.nio.ch.DatagramChannelImpl.send0(Native Method)
at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:304)
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:269)
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:254)
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$PooledSendBuffer.transferTo(SocketSendBufferPool.java:239)
at org.jboss.netty.channel.socket.nio.NioDatagramWorker.write0(NioDatagramWorker.java:540)
... 7 more

@menacher
Copy link
Owner

Ok. To check if this is related to UDP only, could you make following changes in code.

  1. In WorldMonitor.java NetworkEvent networkEvent = Events.networkEvent(buffer,DeliveryGuarantyOptions.FAST); Change DeliveryGuaranty to RELIABLE.
  2. Change Delivery guaranty to RELIABLE in org.menacheri.zombie.game.SessionHandler class also.
  3. In ZombieJetclient remove the following udp connect parameters when building the login helper .jetserverUdpHostName("255.255.255.255").udpPort(18090).
    Please let me know result. Thanks again for raising this.

@jacy
Copy link
Author

jacy commented Jun 22, 2012

Wow, Everything works perfectly after changes was made in the way you just suggested. Things turn out like that something happend unexpected on UDP connection.

Thank you so much for your replies.

@menacher
Copy link
Owner

I will keep the issue open, since UDP is also supposed to work. It could be local env issue. One way to test it out would be run netty's UDP example If this also causes same issue then it is problem at network side, else it could also be because of jetserver issue.

@jacy
Copy link
Author

jacy commented Jun 23, 2012

I have tried the netty's UDP example and so far so good,it seemed to run smoothly without any exception. BTW,I am a fresh man on socket programming and really apologize for being helpless on the issue shooting.

@menacher
Copy link
Owner

No problem! Am busy this weekend will take a look and let you know if we can have UDP back on.

@jacy
Copy link
Author

jacy commented Jun 23, 2012

KIND of you,thanks.

@menacher menacher closed this as completed Nov 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants