You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Sandeep Tamhankar (JIRA)" <ji...@apache.org> on 2012/05/02 01:52:49 UTC

[jira] [Created] (HTTPCORE-298) SSLIOSession state can get out of sync with underlying IOSession state

Sandeep Tamhankar created HTTPCORE-298:
------------------------------------------

             Summary: SSLIOSession state can get out of sync with underlying IOSession state
                 Key: HTTPCORE-298
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-298
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore NIO
    Affects Versions: 4.1.4
         Environment: observed on Ubuntu 10.0.4, but I think it could happen anywhere
            Reporter: Sandeep Tamhankar


Under heavy load, I've observed my application call SSLIOSession.isClosed() to decide if the connection can be reused for a pending outbound request. It returns false. However, the underlying IOSessionImpl is actually closed. I believe that AbstractIOReactor also holds a reference to that underlying IOSession and it can be independently closed from that end.

My proposed fix is simple (and very non-invasive, but possibly not correct in that I don't have the SSLIOSession update its state upon discovering that the underlying IOSession is closed): update SSLIOSession.isClosed as followed:
    public boolean isClosed() {
        return this.status >= CLOSING || this.session.isClosed();
    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-298) SSLIOSession state can get out of sync with underlying IOSession state

Posted by "Sandeep Tamhankar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266674#comment-13266674 ] 

Sandeep Tamhankar commented on HTTPCORE-298:
--------------------------------------------

Yes, I agree... and I was hoping that you'd have an epiphany based on my description! ;)

I don't have a reproducible case, so I tried to track the sessions in AbstractIOReactor.sessions just walking through code. My guess is that there's some sort of abnormal termination of the connection that causes the IOSession to be added to AbstractIOReactor.closedSessions.

We're talking about a load situation here; maybe a socket connect timeout or read timeout? I see that queueClosedSession has many callers and the code path that leads to the call is always from a CancelledKeyException... except in processNewChannels, where the IOSession is created with a close callback to call queueClosedSession.

I'm new to this code-base, so I'm hoping you can deduce the core issue from here.
                
> SSLIOSession state can get out of sync with underlying IOSession state
> ----------------------------------------------------------------------
>
>                 Key: HTTPCORE-298
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-298
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.4
>         Environment: observed on Ubuntu 10.0.4, but I think it could happen anywhere
>            Reporter: Sandeep Tamhankar
>             Fix For: 4.2.1
>
>
> Under heavy load, I've observed my application call SSLIOSession.isClosed() to decide if the connection can be reused for a pending outbound request. It returns false. However, the underlying IOSessionImpl is actually closed. I believe that AbstractIOReactor also holds a reference to that underlying IOSession and it can be independently closed from that end.
> My proposed fix is simple (and very non-invasive, but possibly not correct in that I don't have the SSLIOSession update its state upon discovering that the underlying IOSession is closed): update SSLIOSession.isClosed as followed:
>     public boolean isClosed() {
>         return this.status >= CLOSING || this.session.isClosed();
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-298) SSLIOSession state can get out of sync with underlying IOSession state

Posted by "Sandeep Tamhankar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266676#comment-13266676 ] 

Sandeep Tamhankar commented on HTTPCORE-298:
--------------------------------------------

Oh, almost forgot: I am using jdk 1.7.0_03.
                
> SSLIOSession state can get out of sync with underlying IOSession state
> ----------------------------------------------------------------------
>
>                 Key: HTTPCORE-298
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-298
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.4
>         Environment: observed on Ubuntu 10.0.4, but I think it could happen anywhere
>            Reporter: Sandeep Tamhankar
>             Fix For: 4.2.1
>
>
> Under heavy load, I've observed my application call SSLIOSession.isClosed() to decide if the connection can be reused for a pending outbound request. It returns false. However, the underlying IOSessionImpl is actually closed. I believe that AbstractIOReactor also holds a reference to that underlying IOSession and it can be independently closed from that end.
> My proposed fix is simple (and very non-invasive, but possibly not correct in that I don't have the SSLIOSession update its state upon discovering that the underlying IOSession is closed): update SSLIOSession.isClosed as followed:
>     public boolean isClosed() {
>         return this.status >= CLOSING || this.session.isClosed();
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCORE-298) SSLIOSession state can get out of sync with underlying IOSession state

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-298.
----------------------------------------

    Resolution: Fixed

I reviewed the code and found some fairly rare but legitimate situations when the I/O reactor had to close an I/O session. So, the proposed fix makes good sense. Committed to SVN trunk.

Oleg  
                
> SSLIOSession state can get out of sync with underlying IOSession state
> ----------------------------------------------------------------------
>
>                 Key: HTTPCORE-298
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-298
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.4
>         Environment: observed on Ubuntu 10.0.4, but I think it could happen anywhere
>            Reporter: Sandeep Tamhankar
>             Fix For: 4.2.1
>
>
> Under heavy load, I've observed my application call SSLIOSession.isClosed() to decide if the connection can be reused for a pending outbound request. It returns false. However, the underlying IOSessionImpl is actually closed. I believe that AbstractIOReactor also holds a reference to that underlying IOSession and it can be independently closed from that end.
> My proposed fix is simple (and very non-invasive, but possibly not correct in that I don't have the SSLIOSession update its state upon discovering that the underlying IOSession is closed): update SSLIOSession.isClosed as followed:
>     public boolean isClosed() {
>         return this.status >= CLOSING || this.session.isClosed();
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-298) SSLIOSession state can get out of sync with underlying IOSession state

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-298:
---------------------------------------

    Fix Version/s: 4.2.1

I certainly do not see a problem with making such a change. However I would like to understand why the I/O and SSL sessions got out of sync in the first place. Do you happen to know if there is anything in your application code that can close the underlying i/o session bypassing the SSL layer? The only reason for an I/O session to get shut down by the I/O reactor is due to an unexpected runtime exception.

Oleg 
                
> SSLIOSession state can get out of sync with underlying IOSession state
> ----------------------------------------------------------------------
>
>                 Key: HTTPCORE-298
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-298
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.4
>         Environment: observed on Ubuntu 10.0.4, but I think it could happen anywhere
>            Reporter: Sandeep Tamhankar
>             Fix For: 4.2.1
>
>
> Under heavy load, I've observed my application call SSLIOSession.isClosed() to decide if the connection can be reused for a pending outbound request. It returns false. However, the underlying IOSessionImpl is actually closed. I believe that AbstractIOReactor also holds a reference to that underlying IOSession and it can be independently closed from that end.
> My proposed fix is simple (and very non-invasive, but possibly not correct in that I don't have the SSLIOSession update its state upon discovering that the underlying IOSession is closed): update SSLIOSession.isClosed as followed:
>     public boolean isClosed() {
>         return this.status >= CLOSING || this.session.isClosed();
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org