ClosedChannelException causes IOReactor to shut down
----------------------------------------------------

                 Key: HTTPCORE-169
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-169
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore NIO
    Affects Versions: 4.0-beta2
            Reporter: Anders Wallgren
            Priority: Critical
         Attachments: AbstractIOReactor.patch, 
AbstractMultiworkerIOReactor.patch

I've finally had time to track down a problem that's been happening 
intermittently for the past few weeks.

The symptom of the problem is that the IOReactor shuts down during one of our 
unit tests (always the same test).

The test before the test that fails cancels an NIO session request before it 
completes, and I believe what might be happening is this session request ends 
up being processed by the IOReactor during the next test (the IOReactor remains 
running between these tests).

AbstractIOReactor.processNewChannels calls 
AbstractSelectableChannel.configureBlocking, which throws a 
ClosedChannelException.

AbstractIOReactor.processNewChannels reacts to this by throwing an 
IOReactorException, which in turn causes AbstractMultiworkerIOReactor.execute 
to call doShutdown.

This is an expected error condition, so it shouldn't cause the IOReactor to 
exit.

I'm including some supporting stack traces below -- note that I added some 
logging to the 4.0-beta2 code, so I'm also including patch files so line 
numbers can line up (though you probably won't need them -- the problem seems 
straightfoward to me).

The ClosedChannelException happens:
2008-08-17T16:35:27.424 | DEBUG | ntHttpManager |                               
                | AbstractMultiworkerIOReactor   | Worker exception in execute()
org.apache.http.nio.reactor.IOReactorException: Failure registering channel 
with the selector
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:227)
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:158)
        at 
org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:70)
        at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:341)
        at java.lang.Thread.run(Thread.java:619)
        at 
com.electriccloud.util.queue.CommanderThread.run(CommanderThread.java:94)
Caused by: java.nio.channels.ClosedChannelException
        at 
java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:252)
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:224)
        ... 5 more

Right after that, the shutdown happens:

2008-08-17T16:35:27.425 | INFO  | ntHttpManager |                               
                | AbstractIOReactor              | gracefulShutdown: [EMAIL 
PROTECTED]
java.lang.Exception: Stack trace from gracefulShutdown
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.gracefulShutdown(AbstractIOReactor.java:338)
        at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.doShutdown(AbstractMultiworkerIOReactor.java:240)
        at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:203)
        at 
com.electriccloud.commander.agent.AgentSocketManager.innerRun(AgentSocketManager.java:280)
        at 
com.electriccloud.util.FailsafeRunnable.run(FailsafeRunnable.java:136)
        at java.lang.Thread.run(Thread.java:619)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to