Fix ideogram crash: mm: dont reset cast buffers in cleanup_models_gc()#14372
Merged
comfyanonymous merged 5 commits intoJun 9, 2026
Merged
Conversation
cleanup_models_gc can be called once per load_models_gpu via free_memory, which in turn can de-activate an active model via this reset_cast_buffers. cleanup_models_gc() could also come via obscure garbage collector paths so limit reset_cast_buffers to the post-node callsite instead.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR removes a call to reset_cast_buffers() at the start of cleanup_models_gc in comfy/model_management.py. The function now immediately scans current_loaded_models for dead models and only calls gc.collect()/soft_empty_cache() when dead models are detected; no other logic was changed. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
kijai
approved these changes
Jun 9, 2026
alexisrolland
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#14289
cleanup_models_gc can be called once per load_models_gpu via free_memory, which in turn can de-activate an active model via this reset_cast_buffers.
cleanup_models_gc() could also come via obscure garbage collector paths so limit reset_cast_buffers to the post-node callsite instead.
This was affecting low RAM users of ideogram, where the independent load calls meant one model was marked inactivate and could get cause a bad state stealing its own pins.
Example test conditions:
Windows, RTX5060, 16GB RAM
Ideogram4 fp8
Before:
After:
Regression tests:
Linux, 5090, 96GB, ideogram4 ✅
Linux, 5090, 96GB, stable cascade ->Flux2 ✅
Linux, 5090, 96GB, ace step 1.5 XL ✅
Linux, 5090, 96GB, LTX2.3 ✅
Linux, 5090, 96GB, Wan 2.2 2x14B ✅
Linux, 5090, 96GB, qwen ✅
Windows, 5060, 16GB, LTX2.3 ✅