[Twisted-Python] are there known ssl/threading/socket issues with httplib2/httplib and Twisted ?

Andrew Bennetts andrew at bemusement.org
Wed Sep 17 19:44:11 MDT 2014


Jonathan Vanasco wrote:
> 
> Background:
> 	I'm using a 3rd party API client, which uses httplib2 in the internals.
> 	( the google-plus api )
> 	I'm placing this blocking code within a DeferredList, that runs within a
> 	twisted.enterprise.adbapi.ConnectionPool.runInteraction
> 
> In my initial tests, everything worked fine -- but I was only making a single
> GET/POST, as I kept the size of the DeferredList to 1 while I worked on the
> code.
> 
> As soon as I increased the limit and had 2 GET/POST events firing off at the
> same time, I started getting a ssl/socket error   ( httplib2 > httplib >
> socket > ssl ).

What's the error?

> It works fine in twisted if I make simultaneous requests otherwise (using
> twisted or the `requests` package).  this seems to be tied to how
> httplib2/httplib is running within twisted.

There shouldn't be anything special about httplib2/httplib “within twisted”.
Unless httplib2 is mucking with global socket defaults or something (and I doubt
it does) I wouldn't expect any interaction between the two at all.  It's no
different to using httplib2 in a thread without Twisted.

-Andrew.

> 
> Has anyone experienced this before?  if so, do you know if there is a
> workaround?
> 
> The easiest fix, is probably for me to write a new ApiClient tomorrow for the
> methods I need.  I'd just like to avoid that if possible
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 




More information about the Twisted-Python mailing list