Overview
Features
Download
Documentation
Community
Add-Ons & Services

HTTPSClientSession and keep-alive

Please post support and help requests here.

HTTPSClientSession and keep-alive

Postby jengle » 14 Aug 2012, 06:15

Ran into a rather nasty problem recently after switching over from HTTP to HTTPS. The application I'm working on tries to re-use connections as much as possible, we set up keep-alive to allow for an unlimited number of requests and set a timeout of 6 seconds on the server. The client-side is similar, but sets the timeout to 5 seconds. Since most of our traffic is rather "burst-y", this has worked out pretty well, with most scenarios being satisfied with one or two connections at most. The issue I'm seeing now is when we re-use a HTTPSClientSession after it has been idle for a while (I haven't narrowed it down exactly, but significantly longer than the 6 seconds for the server-side to wind-down the connection. When it hits HTTPClientSession::sendRequest, the check for connect/reconnect on line 199 hits true, close is called, and that's when the problems hit. In SecureSocketImpl::close, the call to shutdown() is unguarded by a try/catch, and a failure of POCO_ECONNABORTED is thrown. I might have a usage error here, but at the same time, it seems like SecureSocketImpl::close should be exception-safe.
jengle
 
Posts: 14
Joined: 23 Nov 2011, 00:39

Re: HTTPSClientSession and keep-alive

Postby jengle » 14 Aug 2012, 06:17

Also, just to add, I've put in a hack patch of a try/catch around the shutdown call. It seems to solve my immediate problem, but I'm concerned about what the side-effects are.
jengle
 
Posts: 14
Joined: 23 Nov 2011, 00:39

Re: HTTPSClientSession and keep-alive

Postby guenter » 14 Aug 2012, 06:22

You are right. Putting the shutdown() call in close() in a try...catch block would be a good idea. Fixing that in 1.4.4.
guenter
 
Posts: 1121
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: HTTPSClientSession and keep-alive

Postby jengle » 14 Aug 2012, 06:35

Sweet. Do I get a free t-shirt?
jengle
 
Posts: 14
Joined: 23 Nov 2011, 00:39

Re: HTTPSClientSession and keep-alive

Postby guenter » 22 Aug 2012, 20:04

You can get a free T-Shirt at POCO DevCon Silicon Valley.
guenter
 
Posts: 1121
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: HTTPSClientSession and keep-alive

Postby hs724 » 17 Oct 2012, 15:12

jengle wrote:Ran into a rather nasty problem recently after switching over from HTTP to HTTPS. The application I'm working on tries to re-use connections as much as possible, we set up keep-alive to allow for an unlimited number of requests and set a timeout of 6 seconds on the server. The client-side is similar, but sets the timeout to 5 seconds. Since most of our traffic is rather "burst-y", this has worked out pretty well, with most scenarios being satisfied with one or two connections at most. The issue I'm seeing now is when we re-use a HTTPSClientSession after it has been idle for a while (I haven't narrowed it down exactly, but significantly longer than the 6 seconds for the server-side to wind-down the connection. When it hits HTTPClientSession::sendRequest, the check for connect/reconnect on line 199 hits true, close is called, and that's when the problems hit. In SecureSocketImpl::close, the call to shutdown() is unguarded by a try/catch, and a failure of POCO_ECONNABORTED is thrown. I might have a usage error here, but at the same time, it seems like SecureSocketImpl::close should be exception-safe.


where are can i find the support libraries for httpsclientsession for windows? I browsed through poco v1.5.0beta did not find the source or header. thanks
hs724
 
Posts: 2
Joined: 17 Oct 2012, 15:00


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests