[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580539#action_12580539 ] Oleg Kalnichevski commented on HTTPCLIENT-734: -- Done. Oleg > request.abort() should interrupt thread waiting for a connection > > > Key: HTTPCLIENT-734 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient >Affects Versions: 4.0 Alpha 2 >Reporter: Roland Weber > Fix For: 4.0 Beta 1 > > Attachments: changes.txt, changes.txt, changes.txt, changes.txt, > connabort.patch > > > Calls to HttpRequestBase.abort() will not unblock a thread that is still > waiting for a connection and therefore has no ConnectionReleaseTrigger yet. -- 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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580518#action_12580518 ] Sam Berlin commented on HTTPCLIENT-734: --- Thanks for checking it in -- > request.abort() should interrupt thread waiting for a connection > > > Key: HTTPCLIENT-734 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient >Affects Versions: 4.0 Alpha 2 >Reporter: Roland Weber > Fix For: 4.0 Beta 1 > > Attachments: changes.txt, changes.txt, changes.txt, changes.txt, > connabort.patch > > > Calls to HttpRequestBase.abort() will not unblock a thread that is still > waiting for a connection and therefore has no ConnectionReleaseTrigger yet. -- 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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[
https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580299#action_12580299
]
Oleg Kalnichevski commented on HTTPCLIENT-734:
--
Hi Sam
This looks much better. However, I do not quite like the fact that the proposed
changes introduce a dependency between client protocol layer and the connection
management layer
I personally think it would be cleaner to give he control over the connection
allocation back t to the client request director. Instead of connection manager
injecting some code into the AbortableHttpRequest, how about the connection
manager returning a handle object representing a pending request for a
connection and letting the request director handle it? The request director in
its turn could inject the handle object into the AbortableHttpRequest
public interface ClientConnectionManager {
...
ClientConnectionRequest requestConnection(HttpRoute route,
long timeout,
TimeUnit tunit)
throws ConnectionPoolTimeoutException, InterruptedException;
...
}
public interface ClientConnectionRequest {
ManagedClientConnection getConnection()
throws InterruptedException;
void abort();
boolean isCompleted();
boolean isTimedOut();
boolean isAborted();
}
Does this make any sense to you?
Anyways, let tackle problem in small incremental steps. First thing that we
need, no matter what approach, we take is ability to abort WaitingThread. Then,
we can think of a way to propagate access to that method to the
AbortableHttpRequest.
Oleg
> request.abort() should interrupt thread waiting for a connection
>
>
> Key: HTTPCLIENT-734
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: HttpClient
>Affects Versions: 4.0 Alpha 2
>Reporter: Roland Weber
> Fix For: 4.0 Beta 1
>
> Attachments: changes.txt, changes.txt, changes.txt, connabort.patch
>
>
> Calls to HttpRequestBase.abort() will not unblock a thread that is still
> waiting for a connection and therefore has no ConnectionReleaseTrigger yet.
--
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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580042#action_12580042 ] Oleg Kalnichevski commented on HTTPCLIENT-734: -- Sam, I'll review the patch in the coming days Oleg > request.abort() should interrupt thread waiting for a connection > > > Key: HTTPCLIENT-734 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient >Affects Versions: 4.0 Alpha 2 >Reporter: Roland Weber > Fix For: 4.0 Beta 1 > > Attachments: changes.txt, changes.txt, connabort.patch > > > Calls to HttpRequestBase.abort() will not unblock a thread that is still > waiting for a connection and therefore has no ConnectionReleaseTrigger yet. -- 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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579637#action_12579637 ] Sam Berlin commented on HTTPCLIENT-734: --- That makes sense -- I agree that interrupting is a bad practice. I'll take another stab at it tomorrow... (or feel free to do it in the meantime). > request.abort() should interrupt thread waiting for a connection > > > Key: HTTPCLIENT-734 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient >Affects Versions: 4.0 Alpha 2 >Reporter: Roland Weber > Fix For: 4.0 Beta 1 > > Attachments: changes.txt, connabort.patch > > > Calls to HttpRequestBase.abort() will not unblock a thread that is still > waiting for a connection and therefore has no ConnectionReleaseTrigger yet. -- 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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579632#action_12579632 ] Oleg Kalnichevski commented on HTTPCLIENT-734: -- Sam, This is a tricky one. I kind of dislike the idea of having to interrupt the thread in order to unblock the connection manager. Besides, not all connection manager implementation would necessarily block on connection allocation. So, I am thinking if a better solution could be to return an optional handle object, which could be used to unblock the connection manager without interrupting the thread. Does this make any sense to you? If not, i'll commit your patch as is Oleg > request.abort() should interrupt thread waiting for a connection > > > Key: HTTPCLIENT-734 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient >Affects Versions: 4.0 Alpha 2 >Reporter: Roland Weber > Fix For: 4.0 Beta 1 > > Attachments: changes.txt, connabort.patch > > > Calls to HttpRequestBase.abort() will not unblock a thread that is still > waiting for a connection and therefore has no ConnectionReleaseTrigger yet. -- 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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[
https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562970#action_12562970
]
Roland Weber commented on HTTPCLIENT-734:
-
This is getting nastier the more I think about it. If abort() is called while
waiting for a connection, the thread should be unblocked and an
InterruptedException is thrown. If abort is called after the
ConnectionReleaseTrigger (CRT) becomes available, the connection is released
and the next IO operation will throw an IOException. So far, so good.
If abort() is called just after the connection is obtained and before the CRT
has been set, things get tricky. The thread will be interrupted, but since it
is not blocked it will not get an InterruptedException. We have to check and
reset the interrupt status, release the connection and throw an
InterruptedException. The latter two may happen in reverse order, if the
connection is released in a finally{} block.
We'll need some synchonization and maybe a volatile declaration in
HttpRequestBase, plus code for checking the interrupt status in
ClientRequestDirector (CRD).
The alternative would be that applications have to do both, call abort() and
interrupt the thread to make sure it isn't waiting for a connection. Ensuring
proper connection release in the application would become really challenging if
we require that.
cheers,
Roland
> request.abort() should interrupt thread waiting for a connection
>
>
> Key: HTTPCLIENT-734
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734
> Project: HttpComponents HttpClient
> Issue Type: Improvement
>Affects Versions: 4.0 Alpha 2
>Reporter: Roland Weber
> Fix For: 4.0 Beta 1
>
> Attachments: connabort.patch
>
>
> Calls to HttpRequestBase.abort() will not unblock a thread that is still
> waiting for a connection and therefore has no ConnectionReleaseTrigger yet.
--
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]
[jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt thread waiting for a connection
[ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562904#action_12562904 ] Roland Weber commented on HTTPCLIENT-734: - Hi Oleg, that takes care of opening the connection. But it does not address the interval that a thread spends in allocateConnection(). If we want to address that, we'll have to store a thread in the AbortableHttpRequest and interrupt the thread if there is no ConnectionReleaseTrigger. I'm not sure whether that is what we want, but it seems to be a sensible behavior from a user perspective. Please go ahead and commit the patch, it already improves the behavior. cheers, Roland > request.abort() should interrupt thread waiting for a connection > > > Key: HTTPCLIENT-734 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734 > Project: HttpComponents HttpClient > Issue Type: Improvement >Affects Versions: 4.0 Alpha 2 >Reporter: Roland Weber > Fix For: 4.0 Beta 1 > > Attachments: connabort.patch > > > Calls to HttpRequestBase.abort() will not unblock a thread that is still > waiting for a connection and therefore has no ConnectionReleaseTrigger yet. -- 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]
