VizTracer --log_torch triggers an error and segfault on exit when used in conjunction with PyTorch profiler and the multiprocessing mode of DataLoader, where kineto_results is None.
Author: PEKEWCreated Oct 29, 2025Updated Nov 2, 2025
When using VizTracer's --log_torch feature to sample PyTorch code (DataLoader with multiple workers and large HDF5 files (60GB+) ), the program attempts to export the torch profiler trace on exit, resulting in an AttributeError / RuntimeError. Ultimately, the process segfaults and exits. It appears that VizTracer fails to robustly handle the scenario where the profiler does not properly generate kineto results (with kineto_results being None) upon exit.
The program throws an AttributeError / RuntimeError on exit, and eventually crashes with a segmentation fault (core dumped).
OS: ubuntu 22.04 Python :3.10.19 PyTorch : '2.9.0+cu130'
Source: gaogaotiantian/viztracer