`test_profiling` sometimes times out under TSan
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
We don't currently run test_profiling in the TSan CI, but the context is that I'm trying to get the entire test suite running under thread sanitizer (TSan).
Some of the tests in test_profiling fail to attach in time when run with thread sanitizer, because the sanitizer makes everything slower. This is especially the case when running tests in parallel with -j.
Here's a example:
ERROR: test_run_failed_script_live (test.test_profiling.test_sampling_profiler.test_live_collector_ui.TestLiveModeErrors.test_run_failed_script_live)
Test that running a failing script exits with clean error.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/sgross/tsan-cpython/Lib/profiling/sampling/cli.py", line 279, in _run_with_sync
_wait_for_ready_signal(sync_sock, process, _SYNC_TIMEOUT_SEC)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sgross/tsan-cpython/Lib/profiling/sampling/cli.py", line 223, in _wait_for_ready_signal
raise socket.timeout("timed out")
TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sgross/tsan-cpython/Lib/profiling/sampling/cli.py", line 1110, in _handle_live_run
process = _run_with_sync(cmd, suppress_output=True)
File "/home/sgross/tsan-cpython/Lib/profiling/sampling/cli.py", line 289, in _run_with_sync
raise RuntimeError(
"Process failed to signal readiness within timeout"
)
RuntimeError: Process failed to signal readiness within timeout
I think the problem is that the the _SYNC_TIMEOUT_SEC of 5 seconds isn't enough in this case:
Here are some options to consider:
- Make
_SYNC_TIMEOUT_SECconfigurable via a command line option and specify a larger value for the tests (i.e., SHORT_TIMEOUT) - Make
_SYNC_TIMEOUT_SECconfigurable via environment variable - Skip these tests under TSan
- ???
cc @pablogsal
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.
Direzione di ricerca
Inizia in Lib/profiling/sampling/cli.py, in corrispondenza di _SYNC_TIMEOUT_SEC e _wait_for_ready_signal, quindi esamina il caso test_profiling non riuscito test_run_failed_script_live. Esegui i test di profiling sotto TSan, inclusa l’esecuzione parallela con -j, e confronta le convenzioni esistenti dei test per il comportamento specifico dei sanitizer. Il lavoro è completato quando i test interessati terminano in modo affidabile sotto TSan senza indebolire la normale copertura dei test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- performance, testing
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100