Issue Details (XML | Word | Printable)

Key: DIRMINA-83
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Trustin Lee
Reporter: Trustin Lee
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
MINA

SocketIoProcessor halts if channel is closed while flushing.

Created: 28/Aug/05 06:06 PM   Updated: 26/May/09 12:46 AM
Return to search
Component/s: None
Affects Version/s: 0.7.3
Fix Version/s: 0.7.4

Time Tracking:
Not Specified

Resolution Date: 28/Aug/05 06:08 PM


 Description  « Hide
From Rodrigo Kumpera's report:

Great work with mina, it do makes writting nio servers easy. I´m
writing a filtering server and have the following scenario:

1-incoming connections, using ServiceRegistry with IoHandler.
2-filtering is done in a separate pool (using doug lea's
util.concurrent package)
3-fowarding the result to another server, using SocketIoProcessor and
IoThreadPoolFilter.

So fair I´ve been able to fine tune the thread pool used by the
ServiceRegistry (1).

My problem is with (2) and (3), I want to have a single thread pool to
be shared by the 3 stages of the server.
With the filtering stage I´m thinking about playing with
IoThreadPoolFilter implementation to use util.concurrent and expose
it's interface.
My problem when using a thread pool with the last stage, when
connecting to foreign hosts, is that it throws the following exception
under moderate load:

java.nio.channels.CancelledKeyException
       at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55)
       at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:59)
       at org.apache.mina.io.socket.SocketIoProcessor.flush(SocketIoProcessor.j
ava:511)
       at org.apache.mina.io.socket.SocketIoProcessor.flushSessions(SocketIoPro
cessor.java:422)
       at org.apache.mina.io.socket.SocketIoProcessor.access$300(SocketIoProces
sor.java:41)
       at org.apache.mina.io.socket.SocketIoProcessor$Worker.run(SocketIoProces
sor.java:546)

I tried to use the same IoThreadPoolFilter with an instance of
SocketIoProcessor and ServiceRegistry, but it doesn´t seen to work,
the server halts and don't make any progress.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #263846 Sun Aug 28 09:07:38 UTC 2005 trustin Fix for DIRMINA-83 - SocketIoProcessor halts if channel is closed while flushing.
* Added catch clause for CancelledKeyException in flushSessions()
Files Changed
MODIFY /directory/network/branches/0.7/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
MODIFY /directory/network/branches/0.7/src/java/org/apache/mina/util/BaseThreadPool.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java