|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
[jira] Created: (HTTPCLIENT-883) SO_TIMEOUT is not set on a request levelSO_TIMEOUT is not set on a request level
---------------------------------------- Key: HTTPCLIENT-883 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-883 Project: HttpComponents HttpClient Issue Type: Bug Components: HttpClient Affects Versions: 4.0 Final Reporter: Moshe Ben-Shoham The scenario is as follows: I'm doing two consecutive requests to the same host, using a multi-threaded (or thread safe) connection pool manager. The first invocation has a timeout of 10s and the second has a timeout of 30s. In version 3.1 of HttpClient all works well, but in 4.0 I get a timeout exception in the second request, after ~10 seconds, which means the first timeout is used. Looking at the code, I see that in version 3.1, the HttpMethodDirector.executeWithRetry() method invokes a method named applyConnectionParams() that took care of setting the timeout taken from the request on the socket. But in version 4.0, the only place I see the timeout is set on the socket is when DefaultRequestDirector.execute(HttpHost, HttpRequest, HttpContext) opens a connection using the managedConn.open() method. Since the connection is reused between the requests, the second request uses a socket with a timeout of the first request. -- 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: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
[jira] Updated: (HTTPCLIENT-883) SO_TIMEOUT is not set on a request level[ https://issues.apache.org/jira/browse/HTTPCLIENT-883?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski updated HTTPCLIENT-883: ----------------------------------------- Fix Version/s: 4.1 Alpha1 4.0.1 > SO_TIMEOUT is not set on a request level > ---------------------------------------- > > Key: HTTPCLIENT-883 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-883 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Reporter: Moshe Ben-Shoham > Fix For: 4.0.1, 4.1 Alpha1 > > > The scenario is as follows: I'm doing two consecutive requests to the same host, using a multi-threaded (or thread safe) connection pool manager. The first invocation has a timeout of 10s and the second has a timeout of 30s. > In version 3.1 of HttpClient all works well, but in 4.0 I get a timeout exception in the second request, after ~10 seconds, which means the first timeout is used. > Looking at the code, I see that in version 3.1, the HttpMethodDirector.executeWithRetry() method invokes a method named applyConnectionParams() that took care of setting the timeout taken from the request on the socket. > But in version 4.0, the only place I see the timeout is set on the socket is when DefaultRequestDirector.execute(HttpHost, HttpRequest, HttpContext) opens a connection using the managedConn.open() method. Since the connection is reused between the requests, the second request uses a socket with a timeout of the first request. -- 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: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
[jira] Commented: (HTTPCLIENT-883) SO_TIMEOUT is not set on a request level[ https://issues.apache.org/jira/browse/HTTPCLIENT-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769834#action_12769834 ] Oleg Kalnichevski commented on HTTPCLIENT-883: ---------------------------------------------- There is an effective work-around for the problem: --- DefaultHttpClient httpclient = new DefaultHttpClient(); httpclient.addRequestInterceptor(new HttpRequestInterceptor() { public void process( final HttpRequest request, final HttpContext context) throws HttpException, IOException { HttpClientConnection conn = (HttpClientConnection) context.getAttribute( ExecutionContext.HTTP_CONNECTION); int timeout = request.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0); conn.setSocketTimeout(timeout); } }); HttpGet request = new HttpGet("http://www.google.com/"); HttpResponse rsp = httpclient.execute(request); HttpEntity entity = rsp.getEntity(); System.out.println("----------------------------------------"); System.out.println(rsp.getStatusLine()); System.out.println("----------------------------------------"); if (entity != null) { entity.consumeContent(); } --- > SO_TIMEOUT is not set on a request level > ---------------------------------------- > > Key: HTTPCLIENT-883 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-883 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Reporter: Moshe Ben-Shoham > Fix For: 4.0.1, 4.1 Alpha1 > > > The scenario is as follows: I'm doing two consecutive requests to the same host, using a multi-threaded (or thread safe) connection pool manager. The first invocation has a timeout of 10s and the second has a timeout of 30s. > In version 3.1 of HttpClient all works well, but in 4.0 I get a timeout exception in the second request, after ~10 seconds, which means the first timeout is used. > Looking at the code, I see that in version 3.1, the HttpMethodDirector.executeWithRetry() method invokes a method named applyConnectionParams() that took care of setting the timeout taken from the request on the socket. > But in version 4.0, the only place I see the timeout is set on the socket is when DefaultRequestDirector.execute(HttpHost, HttpRequest, HttpContext) opens a connection using the managedConn.open() method. Since the connection is reused between the requests, the second request uses a socket with a timeout of the first request. -- 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: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
[jira] Resolved: (HTTPCLIENT-883) SO_TIMEOUT is not set on a request level[ https://issues.apache.org/jira/browse/HTTPCLIENT-883?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski resolved HTTPCLIENT-883. ------------------------------------------ Resolution: Fixed Fixed in trunk and 4.0.x branch Oleg > SO_TIMEOUT is not set on a request level > ---------------------------------------- > > Key: HTTPCLIENT-883 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-883 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Reporter: Moshe Ben-Shoham > Fix For: 4.0.1, 4.1 Alpha1 > > > The scenario is as follows: I'm doing two consecutive requests to the same host, using a multi-threaded (or thread safe) connection pool manager. The first invocation has a timeout of 10s and the second has a timeout of 30s. > In version 3.1 of HttpClient all works well, but in 4.0 I get a timeout exception in the second request, after ~10 seconds, which means the first timeout is used. > Looking at the code, I see that in version 3.1, the HttpMethodDirector.executeWithRetry() method invokes a method named applyConnectionParams() that took care of setting the timeout taken from the request on the socket. > But in version 4.0, the only place I see the timeout is set on the socket is when DefaultRequestDirector.execute(HttpHost, HttpRequest, HttpContext) opens a connection using the managedConn.open() method. Since the connection is reused between the requests, the second request uses a socket with a timeout of the first request. -- 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: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |