message.data becoms None in spawned greenlets
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- backend, networking
Línea de trabajo
Start at ws4py.websocket.WebSocket and the received_message entry point, then trace the message lifecycle when gevent.spawn runs the handler. Reproduce the reported behavior if possible and determine what should preserve message.data; done means spawned handlers receive the original data without requiring deepcopy, with a regression test if the project supports one.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi there,
I don't have a self-contained test case but I can easily reproduce the following nevertheless in my project.
In a subclass of ws4py.websocket.WebSocket that is running in a gevent-based server I implemented the received_message method.
This works fine as long as it looks similar to the below:
def received_message(self, message):
_self._on_received_message(message.data)
However, the moment I spawn the handler function into its own greenlet as below ..
from gevent import spawn
def received_message(self, message):
spawn(_self._on_received_message, message.data)
.. message.data becomes None somewhere between spawn and the moment _self._on_received_message gets called but at any rate _self._on_received_message receives None, the original data is lost by the time that method is called in its own greenlet.
The workaround is to deepcopy it before spawning the greenlet
from copy import deepcopy
from gevent import spawn
def received_message(self, message):
spawn(_self._on_received_message, deepcopy(message.data))
- Lenguaje dominante
- Python
- Estrellas
- 1.1k
- Forks
- 286
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Lawouach/WebSocket-for-Python
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Lawouach/WebSocket-for-Python#300 ·
-
This project is not well maintained so be very very very patient!Quizá libre de nuevo @Lawouach la tomó hace 661 días y no hay ningún pull request abierto. Abiertoquestion
Lawouach/WebSocket-for-Python#297 · 2 comentarios · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
Lawouach/WebSocket-for-Python#296 ·
-
Make the codes python 3 compatibleQuizá libre de nuevo @auvipy la tomó hace 1067 días y no hay ningún pull request abierto. Abierto
Lawouach/WebSocket-for-Python#280 · 1 comentario · 1 asignado ·
-
Setup new CIQuizá libre de nuevo @auvipy la tomó hace 1238 días y no hay ningún pull request abierto. Abierto
Lawouach/WebSocket-for-Python#275 · 1 asignado ·
Todos los issues de Lawouach/WebSocket-for-Python
Issues similares
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_waitAbiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
krkn-chaos/krkn#1627 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NousResearch/hermes-agent#136483 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
[BUG] LazyStackedTensorDictStore zeroes the last byte of a new key set on the last elementPosiblemente ocupada @peterdsharpe la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pytorch/tensordict#2307 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día