synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <hiranya...@gmail.com>
Subject Re: Why is "java.nio.channels.ClosedChannelException" thrown from Nio Reactor?
Date Wed, 21 Aug 2013 17:09:24 GMT

On Aug 21, 2013, at 3:41 AM, Jeewantha Dharmaparakrama <jeewamp.dev@gmail.com> wrote:

> Hi Hiranya,
> 
> This exception was thrown from an internal version of Synapse at WSO2 used in WSO2 ELB.
It is slightly different from what we have in Apache svn trunk. Internally we migrated to
HTTP core 4.3 as well, but we still have ServerIODispatch which is passed to ioReactor.execute(...).
And this error occurs when a browser client (ELB management console) makes HTTP/HTTPS requests
to Passthru listener in synapse. Apparently an already closed connection is still being used
from Synapse end. BTW can you tell me why ServerIODispatch was removed from trunk when migrating
to HTTPCore 4.3 ?

Once the transport was migrated off all the deprecated Http Core APIs, this no longer was
required. There are better and more up-to-date APIs to obtain the same functionality.

Thanks,
Hiranya

> 
> Jeewantha.
> 
> 
> 
> On Mon, Aug 19, 2013 at 11:21 PM, Hiranya Jayathilaka <hiranya911@gmail.com> wrote:
> I just noticed that this is from a slightly older revision of Synapse. Line numbers in
the stack trace are off. Also the stack trace mentions the class ServerIODispatch, which is
no longer in the code base. It was removed during the migration to HTTP Core 4.3. 
> 
> Can you try your scenario with a latest snapshot build and see if the problem occurs
there, before trying out anything else.
> 
> Thanks,
> Hiranya
> 
> On Aug 19, 2013, at 10:46 AM, Hiranya Jayathilaka <hiranya911@gmail.com> wrote:
> 
>> [Dropped hc list]
>> 
>> Hi Jeewantha,
>> 
>> What's your Synapse configuration? What steps did you have to go through to get this
error? Please specify the exact details, so we can try to reproduce the problem.
>> 
>> Also as Oleg has mentioned, a wire-level log would be very helpful. Enable DEBUG
for the org.apache.synapse.transports package in the log4j.properties to enable this.
>> 
>> Thanks,
>> Hiranya
>> 
>> On Aug 19, 2013, at 1:48 AM, Jeewantha Dharmaparakrama <jeewamp.dev@gmail.com>
wrote:
>> 
>>> Hi All,
>>> 
>>> I have an intermittent issue with Synapse where it prints the following exception
in its Error logs.
>>> [2013-08-15 16:57:28,710] ERROR - SourceHandler Unexpected I/O error: java.nio.channels.ClosedChannelException
>>> 
>>> 
>>> java.nio.channels.ClosedChannelException
>>> 
>>> 
>>> at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:135)
>>> at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:326)
>>> at org.apache.http.impl.nio.reactor.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:167)
>>> at org.apache.http.impl.nio.DefaultNHttpServerConnection.produceOutput(DefaultNHttpServerConnection.java:323)
>>> at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection.produceOutput(LoggingNHttpServerConnection.java:112)
>>> at org.apache.synapse.transport.passthru.ServerIODispatch.onOutputReady(ServerIODispatch.java:87)
>>> at org.apache.synapse.transport.passthru.ServerIODispatch.onOutputReady(ServerIODispatch.java:39)
>>> at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:143)
>>> at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:180)
>>> at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:342)
>>> at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
>>> at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
>>> at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
>>> at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:584)
>>> at java.lang.Thread.run(Thread.java:662)
>>> 
>>> 
>>> 
>>> What happens is for some reason, the corresponding SocketChannel is closed but
still some IO operation is done on it. Once this exception is caught from httpcore-nio, it
will be passed to org.apache.http.nio.NHttpServerEventHandler implementation ( org.apache.synapse.transport.passthru.SourceHandler
) and will be printed on Synapse Error logs. Since this is an intermittent issue,
>>> I tried to reproduce this programmatically but failed [1]. What can be the practical
reason for this Error? Can this be deliberately reproduced with Synapse?
>>> 
>>> [1] http://stackoverflow.com/q/18309283/1411653 
>>> 
>>> Thanks in advance,
>>> Jeewantha.
>> 
>> --
>> Hiranya Jayathilaka
>> Mayhem Lab/RACE Lab;
>> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
>> E-mail: hiranya@cs.ucsb.edu;  Mobile: +1 (805) 895-7443
>> Blog: http://techfeast-hiranya.blogspot.com
>> 
> 
> --
> Hiranya Jayathilaka
> Mayhem Lab/RACE Lab;
> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
> E-mail: hiranya@cs.ucsb.edu;  Mobile: +1 (805) 895-7443
> Blog: http://techfeast-hiranya.blogspot.com
> 
> 

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: hiranya@cs.ucsb.edu;  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com


Mime
View raw message