Fix: Windows access violation during startup when loading comfy_api_nodes (pydantic-core GC issue)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
Các thay đổi nằm trong comfy_api_nodes/apis/__init__.py và nodes.py bên trong init_builtin_api_nodes(). Bọc các import mô hình và việc tải node bằng gc.disable()/gc.enable() như được chỉ định. Xong nghĩa là ComfyUI khởi động trên Windows mà không gặp vi phạm truy cập sau nhiều lần chạy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
On Windows, ComfyUI crashes at startup with Windows fatal exception: access violation while loading the built-in API nodes (comfy_api_nodes). The stack trace points to pydantic's schema generation, triggered during import of comfy_api_nodes/apis/__init__.py (a file with ~1000+ pydantic models).
Root cause
This is a known bug in pydantic-core on Windows: the cyclic garbage collector traverses pydantic-core's internal objects (validators/serializers) while they are still being constructed, corrupting refcounts and causing the access violation. Tracked in pydantic discussion #13839.
Fix
Disable the cyclic GC while constructing all pydantic models in apis/__init__.py and during the loading of built-in API nodes:
In comfy_api_nodes/apis/__init__.py (add at the top):
import gc as _gc
_gc_was_enabled = _gc.isenabled()
_gc.disable()
And at the very end of the file:
if _gc_was_enabled:
_gc.enable()
In nodes.py -> init_builtin_api_nodes():
import gc
gc_was_enabled = gc.isenabled()
gc.disable()
try:
for node_file in api_nodes_files:
if not await load_custom_node(node_file, module_parent="comfy_api_nodes"):
import_failed.append(os.path.basename(node_file))
finally:
if gc_was_enabled:
gc.enable()
Verification
Tested across 8 consecutive startup runs — all completed successfully with no access violations.
Environment
- Windows 11, Python 3.12.10
- pydantic 2.14.2, pydantic-core 2.50.2
- ComfyUI 0.42.5
- Ngôn ngữ chính
- Python
- Star
- 146k
- Fork
- 17.4k
- Merge trung bình
- 19 giờ 44 phút
- Pull request đã merge (30 ngày)
- 178
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Comfy-Org/ComfyUI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ROCm gfx1100: contiguous-k/v SDPA workaround is gfx1151-only, MiniMax H3 sampling 2.2x slower on RX 7900 XTXCó thể đã có người làm @TwelveNights đã nhận 3 ngày trước. Đang mởPotential Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Sub-quadratic attention is ~10x slower on long sequences on RDNA2 (gfx1030) because the key passed to bmm is non-contiguousCó thể đã có người làm @KornienkoDev đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
MoGe-3 output is nondeterministic on CUDA: sparse_pool3d_mean sums with float index_add_ (atomics)Có thể đã có người làm @potoior đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Comfy-Org/ComfyUI#17498 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TRELLIS.2 texture bake fails under --bf16-vae: BakeTextureFromVoxel 'Got unsupported ScalarType BFloat16'Có thể đã có người làm @Shubham-Padkonde đã nhận 11 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Comfy-Org/ComfyUI
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
OCA/account-invoicing#2529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textĐang mởbug imagen skills
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Email validation accepts a trailing newlineCó thể đã có người làm @marcello-pichini đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày