-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
ChannelException when releasing external resources (Windows, Oracle JDK) #395
Comments
I don't think it's your fault but there's a bug in JDK NIO implementation in Windows probably. It is basically saying that it failed to create a new Selector, which should not really happen. Without a selector, Netty can't do any I/O. |
I will close it for now.. |
+1 for this issue, I get the same stack in my client when I try to connect to my server and without a network connection (cable disconnected). No solution found for this? |
No real solution, but a few more observations. Waiting a bit before releasing the resources usually help preventing triggering the issue. Netty 3.5.5.Final stacktrace:
As one can see in the stacktrace, at some point the timeout handling triggers the issue notification to listeners. That's when the
So since the future is completed my code just goes on to release the So now maybe there is a specificity due to the Oracle JVM implementation on windows, but when releasing the
So, is there a way in netty to wait for any pending action inside the channel pipeline (before releasing the resources) ? |
Tested with OpenJDK 6 under Ubuntu: waiting inside So it would look like the netty stacktrace under Windows is a side effect (Oracle implementation that does something that can be interrupted, unlike OpenJDK ?), and that the real issue is that the connection timeout actions can take place while the application has already been notified of the connection failure: hence a possible race condition with resource cleanup. |
Not quite yet it seems:
From the source code lines in the staktrace, it looks like at the time of execution the |
@suiryc thanks for testing.. could you please grab the latest snapshot again and test ? |
Thanks for the fixes. The latest snapshot do not trigger the selector creation issue anymore. There is still an interrupt for code that may be
Anyway I guess having such kind of code may not be what people should do in such a place (exception handling), so maybe someone will have to open a new ticket if he believes this behaviour should be changed. |
@suiryc thanks for the confirm. So we can finally close this and have the fix included. YAY! |
There is one issue left now.. We need to handle the case when a Channel will be registered on an AbstractNioWorker which was shutdown. Sent from my iPhone. Excuse any typos.... Am 03.09.2012 um 21:43 schrieb Julien Coloos notifications@github.com:
|
I had managed to avoid the stack (don't ask me how) but thanks @normanmaurer |
On Windows with Oracle JDK, starting with netty 3.4.0 (3.3.1 is fine) I see strange issues in logs, generally along client connection timeouts.
After some testing I could reproduce it with this dummy client:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DiscardClientHandler extends SimpleChannelHandler {
}
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Test {
}
With netty 3.3.1, I catch (as expected) the connection timeout:
With netty 3.4.0 (up to current 3.5.0), I also see the following unexpected netty log:
This happens on Windows (Oracle JDK, 6 or 7), but not on Ubuntu (OpenJDK 6).
Also the log generally only appears after at least two connections attempts, and is triggered by releaseExternalResources on the channel factory.
I don't know if this is a side effect, but when this happen in a more complex netty configuration it seems a thread remains stuck somewhere because the JVM usually does not stop by itself after resource releasing.
Some search on the intermediate error "Unable to establish loopback connection" shows that it could have been related to a firewall issue. But I did not see anything particular in my firewall logs, and disabling it did not change the outcome.
Is this a bug, or is there something wrong with the way I use netty here ?
The text was updated successfully, but these errors were encountered: