Async topic writer wedges under reconnect: 'cannot schedule new futures after shutdown' in _encode_data_inplace (compressing codec)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Empieza en ydb/_topic_writer/topic_writer_asyncio.py, especialmente en write_with_ack, _encode_loop y _encode_data_inplace, y sigue cómo se crea y se cierra self._encode_executor alrededor de la ruta de reconexión de gRPC. Reproduce el escenario de pérdida de conexión descrito en el issue o la carga de trabajo de caos de PR #851. Se considera terminado cuando un write_with_ack con un codec de compresión se completa o informa de un error después de la reconexión, en lugar de quedarse bloqueado o dejar una excepción del executor sin recuperar.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Under connection loss + reconnect (e.g. a node killed during chaos testing), the async topic writer using a compressing codec (GZIP) can get permanently wedged: write_with_ack never returns because the encode ThreadPoolExecutor was shut down while the writer is still live and re-encoding, so submitting the encode job raises RuntimeError('cannot schedule new futures after shutdown'). The error surfaces only as an unretrieved background future, and the awaiting write_with_ack hangs indefinitely (no timeout of its own).
Traceback (observed)
grpc/aio/_call.py ... raise asyncio.CancelledError() # stream cancelled by the node kill
asyncio.exceptions.CancelledError
ERROR Future exception was never retrieved
future: <Future finished exception=RuntimeError('cannot schedule new futures after shutdown')>
Traceback (most recent call last):
File ".../ydb/_topic_writer/topic_writer_asyncio.py", line 128, in write_with_ack
results = [f.result() for f in futures]
File ".../ydb/_topic_writer/topic_writer_asyncio.py", line 578, in _encode_loop
await self._encode_data_inplace(batch_codec, messages)
File ".../ydb/_topic_writer/topic_writer_asyncio.py", line 599, in _encode_data_inplace
encoded_data_futures = eventloop.run_in_executor(self._encode_executor, encoder_function, ...)
File ".../concurrent/futures/thread.py", line 167, in submit
raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Conditions
ydb.aiotopic writer (topic_client.writer(...)), compressing codec (TopicCodec.GZIP).- Connection drop + reconnect (chaos: a
CancelledErrorpropagates from the gRPC stream). - After that,
_encode_data_inplacesubmits toself._encode_executor, which has already been shut down →RuntimeError.
Impact
write_with_ack never completes → the writer silently hangs. In an application that awaits write_with_ack without its own timeout, the whole writer path stalls. Same class of async-topic-writer reconnect-lifecycle issue as the earlier WriterAsyncIOStream.create() thread leak (PR #845).
Root cause (likely)
self._encode_executor is shut down while the writer is still alive and re-encoding after a reconnect (executor lifecycle not tied correctly to the writer's live/reconnect state).
Workaround
Use TopicCodec.RAW — _encode_data_inplace returns early for RAW and never touches the executor.
How it was found
YDB Python SLO chaos testing (PR #851): the async topic workload silently stalled at ~half the run; the baseline container's delivery metrics went N/A mid-run. The SLO harness was hardened (timeouts + writer/reader recreate + RAW) to not hang, but the underlying SDK writer bug remains.
- Lenguaje dominante
- Python
- Estrellas
- 102
- Forks
- 80
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 ydb-platform/ydb-python-sdk
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ydb-platform/ydb-python-sdk#290 ·
Los mantenedores suelen responder en 1 día
-
dev: Forbid imports relativeAbiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
ydb-platform/ydb-python-sdk#897 ·
Los mantenedores suelen responder en 1 día
-
dev: improve codebase documentationQuizá libre de nuevo @Khabib73 la tomó hace 42 días y no hay ningún pull request abierto. Abiertoenhancement
ydb-platform/ydb-python-sdk#895 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
dev: Refactor legacyPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
ydb-platform/ydb-python-sdk#884 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
feature: [SSO] support OIDC authPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoenhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
ydb-platform/ydb-python-sdk#876 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ydb-platform/ydb-python-sdk
Issues similares
-
[Resource]: glyphcss-diagramsAbiertoresource-submission validation-passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
hesreallyhim/awesome-claude-code#3214 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
room-commons replace accepts an empty old string and silently prepends the new text to the pageAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
doobidoo/mcp-memory-service#1650 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ml-explore/mlx-lm#2002 ·
Los mantenedores suelen responder en 2 días