requests / SSL blocks forever?

Thomas Jollans tjol at tjol.eu
Sat Jan 13 07:01:07 EST 2018


On 13/01/18 11:34, Nagy László Zsolt wrote:
> Hi!
> 
> I have a multi threaded Windows service written in Python. It is running
> on 3.6.2.  Sometimes I cannot stop the service, because on of the
> threads won't exit. I have narrowed down the problem to request and
> _lib.SSL_read. I have used a modified version of this gem:
> http://code.activestate.com/recipes/577334-how-to-debug-deadlocked-multi-threaded-programs/
> 
> So even thould I cannot stop the service (only kill it from task
> manager), I can tell that this is the rebellious thread:
> 
> 
> File: "C:\Python36-32\lib\site-packages\requests\api.py", line 112, in post

Unfortunately, this traceback doesn't contain any of your own code, so
we can't really tell what you're trying to do, or whether this call
*should* be terminating.


> [snip]
>
> File: "C:\Python36-32\lib\site-packages\OpenSSL\SSL.py", line 1624, in
> recv_into
>   result = _lib.SSL_read(self._ssl, buf, nbytes)

so - this is calling a C library. At that point, if the C function
doesn't return, there's not really anything Python can do.

My point is: if the server is simply not sending a response (because
it's waiting for you to send more data, or whatever) but *is* keeping
the TCP connection alive - this could make sense.

Are you setting a timeout?

-- Thomas


> 
> It is possible that there are network outages on this machine, but I
> don't think that this should result in an infinite block.
> 
> The bigest problem is that the only way to restart the service is to
> login remotely, start the task manager and terminate the
> pythonservice.exe process.
> 
> Do any of you have a clue why is this happening? How to fix this?
> 
> Thanks,
> 
>    Laszlo
> 
> 
> 




More information about the Python-list mailing list