Atmosphere / wasync

WebSockets with fallback transports client library for Node.js, Android and Java
http://async-io.org
161 stars 47 forks source link

Race condition in Socket.open #84

Open jonrimmer opened 10 years ago

jonrimmer commented 10 years ago

I am using wasync to connect using websocket to an Atmosphere server that, while developing, is on the same machine. I kept getting timeouts when trying to open the wasync socket, but my logging indicated that a request was being made to the Atmosphere handler, and when I added a breakpoint into the handler to try and diagnose the problem, it stopped happening.

Eventually I discovered that adding a Thread.sleep delay in the Atmosphere handler's processing of the GET request fixed the problem. It seems that wasync has a race condition in its connection code that means it cannot handle situations where the server responds very quickly to the initial request.

jfarcand commented 10 years ago

Which server are you using for testing it? There is a problem with Netty

jfarcand commented 10 years ago

Also can you link to a Test case? Or try one of the unit test to see if you can reproduce. Thanks!

jonrimmer commented 10 years ago

I am using Netty, I guess? I am just using wasync and its default dependencies acquired from Maven Central. I am trying to get a reduced test case, but it's proving a little difficult to disentangle from our application code.