[Windows] Disk offload crashes with access violation after DiskMap.flush_files() (apparent use-after-free)
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
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- python
- Área
- backend, performance
Línea de trabajo
Lee diffsynth/core/vram/disk_map.py y diffsynth/core/vram/layers.py, comenzando por DiskMap.getitem, flush_files() y _load_from_disk. Ejecuta examples/minimax_h3/model_inference_low_vram/MiniMax-H3-NF4-FL2VA.py en Windows con el búfer de disco predeterminado y verifica que la codificación del prompt y la generación completa de 50 pasos se completen sin una violación de acceso.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
- OS: Windows 11 (x64)
- GPU: RTX 4060 Laptop 8 GB (driver 610.62)
- Python 3.12.10, torch 2.11.0+cu128, safetensors 0.8.0, bitsandbytes 0.50.0
- DiffSynth-Studio: current
main, installed viapip install -e ".[quant]"(2026-08-03)
Reproduction
Run the official low-VRAM example examples/minimax_h3/model_inference_low_vram/MiniMax-H3-NF4-FL2VA.py on Windows (disk-offload vram_config with offload_device="disk").
The pipeline loads fine and prompt encoding starts, then the process dies with a hard native crash (no Python exception) while onloading the text encoder layers:
Windows fatal exception: access violation
Current thread 0x00017240 (most recent call first):
File "torch\storage.py", line 471 in __getitem__
File "diffsynth\core\vram\disk_map.py", line 62 in __getitem__
File "diffsynth\core\vram\layers.py", line 496 in _load_from_disk
File "diffsynth\core\vram\layers.py", line 520 in onload
File "diffsynth\diffusion\base_pipeline.py", line 180 in load_models_to_device
File "diffsynth\pipelines\minimax_h3_audio_video.py", line 382 in process
Analysis
DiskMap.__getitem__ calls flush_files() once num_params > buffer_size (default 1e9), which drops the open safe_open handles and re-opens them. Tensors previously returned by get_tensor may still reference the old mmap, so the next access after a flush is a use-after-free. On Windows this surfaces as an access violation inside torch.storage.__getitem__ instead of a catchable Python error.
Workaround
Setting DIFFSYNTH_DISK_MAP_BUFFER_SIZE=1000000000000 (effectively disabling the periodic flush) avoids the crash entirely — a full 50-step MiniMax-H3 generation then completes successfully.
Maybe flush_files() should not invalidate handles while tensors fetched from them can still be alive, or get_tensor results should be fully detached from the mmap before any flush can happen.
- Lenguaje dominante
- Python
- Estrellas
- 13.2k
- Forks
- 1.3k
- Merge medio
- 12 h 52 min
- PR fusionados (30 d)
- 20
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 modelscope/DiffSynth-Studio
-
WanToDance: hardcoded `device='cuda'` in music encoder construction crashes model loading on Ascend NPUPosiblemente ocupada @li-lizhe la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelscope/DiffSynth-Studio#1707 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Partial download surfaces as "Cannot detect the model type" rather than a download errorPosiblemente ocupada @MohammadHijjawi97 la tomó hace 14 días. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
modelscope/DiffSynth-Studio#1668 ·
Los mantenedores suelen responder en 1 día
-
bfloat16训练时段错误: 数组越界的一种方案Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelscope/DiffSynth-Studio#1499 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Latest update broke Wan2.2 S2VAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
modelscope/DiffSynth-Studio#1373 · 5 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
modelscope/DiffSynth-Studio#1735 · 9 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelscope/DiffSynth-Studio
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
topoteretes/cognee#5647 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Sendspin/sendspin-python-cli#291 ·
Los mantenedores suelen responder en 6 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
awslabs/visual-asset-management-system#414 ·
Los mantenedores suelen responder en 1 día
-
bug v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/python-sdk#3670 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aicell-lab/bioengine#232 ·
Los mantenedores suelen responder en 1 día