client channel is not in writable state in netty . Can any experts guide me to find-out the reason
why the channel is always not in writable state?
since it is not in writable state our threads are in sleep mode. We analyzed the state of threads using Thread dump, added a counter in the following loop and it waits for a minute and then exit from the loop. But i really want to figure-out the reason for not writable state.
Is the channel is remains in ctx after the closing of channel(If the EOF is not send by the client)?
If can this happends (means never in writable state)?
while (!ctx.getChannel().isWritable()) {
Thread.sleep(100);
}
Please help.
Thank you very much
Superficially, it is because the ChannelBuffer is full, i.e. no more writable bytes.
It could be caused by writing too fast, or the channel is not able to send out any bytes. If you're not writing anything too fast, perhaps it's because the channel never successfully sent out the bytes written.
You should be using the selector, or whatever Netty gives you around it, to tell you when the channel is writable. You certainly shouldn't be literally wasting time by sleeping in a loop. The channel state can't change while you're doing that. It is only changed by select().
来源:https://stackoverflow.com/questions/15263180/client-channel-is-not-in-writable-statenio-netty