Question

I've decided to describe problem which I met using Netty library. Currently I work on Android client, that send and receive data through websocket and that was the reason why Netty library was chosen.

Now I have NIO mechanism, which handle SSL connection using websockets. Everything works fine, expect one a little bit unusual scenario - when Android client and the server send data to each other in the same time (few requests per second), after a while 'write' operation's ChannelFutureListener never calls 'operationComplete'.

I've made some research and found information that this kind of problem can occur when ssl handshake isn't finished . However I think this scenario doesn't apply to my situation when data is received and sent properly until this extreme situation. Have you any idea where I should looking for solution for this problem?

My research: At first, I found that this problem occurs on Netty4 too but unfortunately Netty3 hasn't channel method like 'writeAndFlush'.

Then I found bug:Issue 1823 which was fixed by this commit and was described here, which could be closely related to my problem. Unfortunately I have problems with build Netty to jar - I have problems with HashedWheelTimer, which calls NoClassDefFoundError everytime when I want to use it. Is it fault how I build this project or is it this branch internal problem? Unfortunately the newest Netty on maven repository (3.9.0.Final) doesn't include this fix.

I've observer strange behaviour of my application: when 'operationComplete' isn't called and I close channel (channel.close()), I get few 'operationComplete' calls from every unfinished 'write' operation. Moreover when I observe state of threads in pool, after problem occurs thread which is responsible for channel is in 'WAIT' state. I am not sure what is a result and what is a cause.

I will really appreciate any ideas what can I do.

PS. Move to Netty4/5 is latest considered option - I suppose it will cost me a lot of time.

Krzysztof Skrzynecki

Was it helpful?

Solution

According to main problem of this 'Netty3 WebSockets with SSl on Android' issue there wasn't any problem with Netty library itself. I've found that it was classic Readers-writers problem with one boolean flag, which was shared resource.

I got wrong track, because I found that other users has similar problems and that was the reason why I thought Netty is a cause.

For others users, who want to use Netty on Android I have just one word - everything works just fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top