benoitc / benoitc/socketpool

Phantom time?

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
167
Forks
33
PR merge metrics
No merged PRs in 30d

Description

I frequently see the following error in logs when socketpool is used from inside a thread (via threading module). I'm unaware if the time module or socketpool are inherently un-thread-safe, nor can I tell if there are any negative effects of the issue. It is quite bizarre though:

The exception:

```
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
File "/opt/webapps/filmbot/venv/local/lib/python2.7/site-packages/socketpool/backend_thread.py", line 50, in run
: 'NoneType' object has no attribute 'sleep'
```

The related code:

``` python
def run(self):
self.running = True
while True:
time.sleep(self.delay)
self.pool.murder_connections()
```

where somehow time has become None.

I see at the top of the backend_thread module that the author assigns a reference to time.sleep, yet never uses the reference and instead still accesses sleep from the time import. Not sure what the utility of that is, or if it's an omission, etc.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.