You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2007/04/11 08:30:32 UTC

[jira] Commented: (DIRMINA-367) 1.1 proxy example broken with svn revision: 522721

    [ https://issues.apache.org/jira/browse/DIRMINA-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488000 ] 

Trustin Lee commented on DIRMINA-367:
-------------------------------------

The additional check is added to fix DIRMINA-362.  isWritable() ans isReadable() is related with readyOps rather than with interestOps, so removing the flag from interestOps won't change the return value of isWritable().

I think there's possibility that data is not written when the connection is closed from the server.  In the proxy example, the client connection is closed immediately if the server connection is closed.  Any write requests not yet flushed out to the channel can be swallowed.  Instead of closing the client connection immediately after the server closes the connection, you could make sure all data received from server is forwarded to the client thoroughly.

You could also provide a stripped down version of your code that reproduces the problem so I can test it.

> 1.1 proxy example broken with svn revision: 522721
> --------------------------------------------------
>
>                 Key: DIRMINA-367
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-367
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>         Environment: linux
>            Reporter: keith mcneill
>
> I just updated to the latest version of mina and my server app broke.  It is partially based on the proxy example.  Looking back through the svn logs, things seem to break on r522721.   I've confirmed this with the stock proxy example.
> The proxy sometimes closes sessions without writing results to the client.  Client gets back zero bytes.   My clients have lots of HTTP like calls....quick in and out exchanges with the server.  
> The line in question is in: core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
> in the doFlush() method the added line from that svn revision is:
> if( key.isWritable() )   ~ line 426
> breaks things.  If I comment it out, things work fine.  
> Looking more closely at the code I don't quite understand how the method is supposed to work.  My nio knowledge is somewhat limited but.  
> When the method is entered we do the following:
> // Clear OP_WRITE
>         SelectionKey key = session.getSelectionKey();
>         key.interestOps( key.interestOps() & ( ~SelectionKey.OP_WRITE ) );
> We clear OP_WRITE.
> then in the for loop we do the:
> if( key.isWritable() ) 
> test.
> How is it ever supposed to report back as writable if we clear OP_WRITE.  Does it work sometimes now because of a race condition with further writes on the socket?

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