benoitc / benoitc/socketpool

Phantom time?

Abierto
#31 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
167
Forks
33
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza leyendo socketpool/backend_thread.py, especialmente run y la referencia a time.sleep a nivel de módulo, y luego reproduce el traceback del apagado del hilo descrito en el issue. Determina por qué time se convierte en None y si la referencia guardada a sleep está destinada a evitarlo; se considera terminado cuando la excepción durante el apagado y su impacto se hayan comprendido y abordado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
networking
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.