`python -m asyncio ps` fails if any task name is longer than 255 characters
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
Inizia in object_reading.c e riproduci il fallimento con l'esempio fornito del nome di un task asyncio, usando python -m asyncio ps o la chiamata RemoteUnwinder mostrata. Il lavoro è completato quando la chiamata ha successo se il nome di un task supera i 255 caratteri e il nome restituito viene troncato a 255 caratteri; controlla il PR collegato gh-157790 per il lavoro già in corso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug report
Bug description:
One task name longer than 255 characters makes python -m asyncio ps fail for the whole process. The length limit is treated as a validity check instead of a cap.
Repro:
import asyncio
import os
from _remote_debugging import RemoteUnwinder
async def main():
asyncio.create_task(asyncio.sleep(10), name='x' * 256)
await asyncio.sleep(0)
print(RemoteUnwinder(os.getpid()).get_all_awaited_by())
asyncio.run(main())
Actually:
Traceback (most recent call last):
File "/Users/timofeiivankov/cpython/repro.py", line 10, in <module>
asyncio.run(main())
~~~~~~~~~~~^^^^^^^^
File "/Users/timofeiivankov/cpython/Lib/asyncio/runners.py", line 205, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/Users/timofeiivankov/cpython/Lib/asyncio/runners.py", line 128, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/Users/timofeiivankov/cpython/repro.py", line 8, in main
print(RemoteUnwinder(os.getpid()).get_all_awaited_by())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
RuntimeError: Invalid string length (256) at 0x101493800
Expected: the call returns and the long name comes back truncated:
[AwaitedInfo(thread_id=21170325, awaited_by=[
TaskInfo(task_id=4312485712, task_name='Task-1', ...),
TaskInfo(task_id=4312485232, task_name='xxx…' (truncated to 255), ...)])]
Proposed fix: Truncate to the limit instead of raising in object_reading.c
I have a fix ready for that
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-157790
- gh-157843
- gh-157826
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Merge medio
- 1g 9h
- PR unite (30g)
- 558
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python/cpython
-
docs pending
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
stdlib type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
stdlib type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
build type-bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
stdlib topic-email type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Tutte le issue di python/cpython
Issue simili
-
link-check link-check:sphinx-theme
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OpenHands/extensions#626 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
CSCfi/sd-search-api#39 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100