You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2006/07/30 14:11:13 UTC

[jira] Created: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

IoSessionOutputStream write methods should not return before the I/O operation is fully completed
-------------------------------------------------------------------------------------------------

                 Key: DIRMINA-229
                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
             Project: Directory MINA
          Issue Type: Bug
    Affects Versions: 0.9.4
            Reporter: Oleg Kalnichevski


IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?

Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)

Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRMINA-229?page=comments#action_12429607 ] 
            
Trustin Lee commented on DIRMINA-229:
-------------------------------------

Wouldn't we need a property that allows a user to swith the synchronous operations into the asynchronous one?

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Assigned To: Niklas Therning
>             Fix For: 0.9.5
>
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-229?page=all ]

Oleg Kalnichevski closed DIRMINA-229.
-------------------------------------


That fixed the problem for me. Thanks a bunch

Oleg

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Assigned To: Niklas Therning
>             Fix For: 0.9.5
>
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-229?page=all ]

Niklas Therning updated DIRMINA-229:
------------------------------------

    Fix Version/s: 0.9.5

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Assigned To: Niklas Therning
>             Fix For: 0.9.5
>
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-229?page=all ]

Oleg Kalnichevski updated DIRMINA-229:
--------------------------------------

    Attachment: mina-bio-stream.patch

Please review

Oleg

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-229?page=all ]

Niklas Therning reassigned DIRMINA-229:
---------------------------------------

    Assignee: Niklas Therning

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Assigned To: Niklas Therning
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-229?page=all ]

Niklas Therning resolved DIRMINA-229.
-------------------------------------

    Resolution: Fixed

I've made the changes as suggested by Oleg. I've also readded the code which joins on the CloseFuture in IoSessionOutputStream.close(). I think it is safe to have it there now when we also join on the writes. I've also added code which throws IOException if a write fails or if the session isn't connected when trying to write. I think this is more in line with the contract of InputStream.

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Assigned To: Niklas Therning
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRMINA-229?page=comments#action_12429616 ] 
            
Niklas Therning commented on DIRMINA-229:
-----------------------------------------

I'm not sure I'd like to have a property for that since InputStreams are supposed to be blocking. However, one thing that I thought of while I applied Oleg's patch was that write() doesn't have to block if we implemented flush() properly. One way of doing that would be to remember the last WriteFuture and then join on that WriteFuture in flush(). close() should then of course call flush() before it closes the session. I think that this wouldn't break people's undertanding of how InputStreams work, yet be more efficient than the current solution. 

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Assigned To: Niklas Therning
>             Fix For: 0.9.5
>
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRMINA-229) IoSessionOutputStream write methods should not return before the I/O operation is fully completed

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRMINA-229?page=comments#action_12424945 ] 
            
Niklas Therning commented on DIRMINA-229:
-----------------------------------------

I think this problem is very bad since things could get very, very messed up if you wrap one of these stream instances in e.g. a BufferedOutputStream. I'm not sure whether we want non blocking writes here. If we use join() as suggested in Oleg's patch we could also check isWritten() on the WriteFuture and throw an IOException if it couldn't be written. WDYT?

BTW, the patch looks great. I have no objections. But I would like to add the isWritten() check as well. I'll go ahead and apply it right away.

> IoSessionOutputStream write methods should not return before the I/O operation is fully completed
> -------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-229
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-229
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Oleg Kalnichevski
>         Attachments: mina-bio-stream.patch
>
>
> IoSessionOutputStream write methods return before the I/O operation is fully completed, which causes issues in protocol handlers based on blocking InputStream/OutputStream model. Is it a desired behaviour?
> Per discussion with Peter Royal on the HttpComponents mailing list I am working on a simple HTTP server based on MINA and HttpComponents Core.  HttpCore does not work with the latest SVN snapshot of MINA without this patch (attached)
> Oleg

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira