Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Finagle client will always result in "ChannelWriteException" when I run Finagle Server on Windows and use zookeeper for serverset #243

Closed
wenfengzhuo opened this Issue · 12 comments

5 participants

@wenfengzhuo

I use Finagle framework to build my server and client, and use zookeeper for Finagle ServerSet. When I setup my dev environment on Linux/Mac, they works great. But When I setup my dev environment on Windows, namely I run the Finagle server on Windows, the finagle client always result in the following errors:

Exception in thread "main" com.twitter.finagle.ChannelWriteException: org.jboss.netty.channel.ConnectTimeoutException: connection timed out: [MyDomain]/192.168.1.130:5233
    at com.twitter.finagle.NoStacktrace(Unknown Source)
Caused by: org.jboss.netty.channel.ConnectTimeoutException: connection timed out: [MyDomain]/192.168.1.130:5233
    at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:137)
    at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
    at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

When I run Finagle Server on Linux/Mac, and run Finagle Client on Windows, it works great, I am doubting that whether there exists some bugs when using finagle on Windows.

@sprsquish

Looks like Windows' firewall is probably blocking the port.

@wenfengzhuo

I have close all windows firewall. Here is my configuration.
capture

@sprsquish

I don't know much about debugging on Windows. Do you know if the server is binding to the right interface?

@wenfengzhuo

Yes, the interface is correct(Local Area Network: [MyDomain]/192.168.1.130:5233) . I never used Finagle in Windows before, just recently I setup the ENV to Windows, and the situation happens.

@sprsquish

That's the interface the client is trying to connect to, but what is the server binding to? On linux you can use the lsof utility to see what's bound to what. Is there something like that for Windows?

@wenfengzhuo

The server log suggests that it binds to the interface which is the same with the one client connects. Now I found that when I use loopbackaddress(127.0.0.1), client works fine. And when the server bind the LAN Address(192.168..), the client did not work.

@mosesn
Owner

We'd be happy to accept a pull request--I think the right solution might be to use InetAddress.getLoopBackAddress(), but it's java 7 only, and we still need to support java 6.

@wenfengzhuo

It's easy to get lookbackaddress whether you are using Java7 or Java6 (brute force to find it). But my concern is whether Finagle is able to startup in LAN on Windows Platform.

@sprsquish

@mosesn the server still needs to be able to bind to the external address.

I'm not sure why Windows would block that. Are there tools for inspecting the network stack on Windows?

@stevegury

You can use tcpview (http://technet.microsoft.com/en-us/sysinternals/bb897437) to check if the server is correctly binding the port. It's also possible that you may need certain privileges to bind a port on a non local address, you should try to run the server "run as administrator".

@trustin

I vaguely guess this might be related with weak/strong host models in Windows:

http://stackoverflow.com/questions/12818970/socket-bind-then-connect-on-ms-loopback-nic
http://technet.microsoft.com/en-us/magazine/2007.09.cableguy.aspx

Could you run the netsh command in the StackOverflow answer to enable weak host model to see if this is the cause?

@mosesn
Owner

@wenfengzhuo are you still running into this problem? Since this is so old, I'm going to close this for now, but feel free to reopen if this is still causing you trouble.

@mosesn mosesn closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.