[ 
https://issues.apache.org/jira/browse/HTTPCORE-76?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502545
 ] 

Sandeep Tamhankar commented on HTTPCORE-76:
-------------------------------------------

I will do so, but before I do, I think I want to make one more change.  The 
effect of my change is that SSL connections are never gracefully shut down 
(meaning the ssl-close and close-notify handshake isn't used).  I'd like to add 
an option to NHttpConnectionBase.shutdown that indicates whether to do a normal 
shutdown or force shutdown.  Then in my application code, when I know that I 
want to do a force-shutdown, I can, but for other areas where I want to close a 
connection for other reasons, I can do a graceful shutdown of it.

How do you feel about NHttpConnectionBase having two shutdown methods:

shutdown() {
   shutdown(false);
}

shutdown(boolean force) {
  if (force) {
      // call shutdown on IOSession object.
  } else {
     // call close() on IOSession object.
  }
}

If this seems reasonable to you, I'll make that change and then submit the 
unified diff.

> Closing SSLIOSession for hung SSL session can hang app
> ------------------------------------------------------
>
>                 Key: HTTPCORE-76
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-76
>             Project: HttpComponents Core
>          Issue Type: Bug
>    Affects Versions: 4.0-alpha5
>            Reporter: Sandeep Tamhankar
>             Fix For: 4.0-alpha5
>
>         Attachments: IOSession.java, IOSession.java, IOSessionImpl.java, 
> NHttpConnectionBase.java, SSLIOSession.java
>
>
> Scenario:
> * You use an SSLClientIOEventDispatch in a DefaultConnectingIOReactor so that 
> SSL connections will be opened.
> * Use the reactor to send an https request to an SSL server.  Have the SSL 
> server not respond (block forever).
> * Have the app get its hands on NHttpClientConnection and try to shut down 
> the connection.
> Expected Result:
> The selector waiting on the response from the hung server should wake up.
> Actual Result:
> The selector is never told to wake up.
> I believe the issue is that NHttpConnectionBase.shutdown calls close on the 
> underlying IOSession.  For plain http, the IOSession is an IOSessionImpl, and 
> close does the right thing.  For an SSLIOSession, close just shuts down the 
> outbound connection (I guess preparing for an orderly SSL shutdown).  For a 
> hung server, you'll never wake up.  If you know the server is hung apriori 
> (as I do in my use case), I'd like a way to force shutdown the connection.
> In my source, I added a shutdown method to IOSession and IOSessionImpl 
> (SSLIOSession already has a shutdown method).  From 
> NHttpConnectionBase.shutdown, I call IOSession.shutdown rather than 
> IOSession.close.  I have IOSessionImpl.shutdown simply call close(), which 
> does the right thing.  And SSLIOSession.shutdown already does what I want -- 
> closes the embedded IOSessionImpl, which wakes up the selector.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to