krita-ai-diffusion icon indicating copy to clipboard operation
krita-ai-diffusion copied to clipboard

Updating ComfyUI workflow causes Krita to completely freeze

Open ArgentVASIMR opened this issue 6 months ago • 2 comments

Connecting to the ComfyUI backend itself doesn't outright cause any problems, at first. But, when I drag around a node in my ComfyUI workflow (which is the way I usually get ComfyUI to update the custom graph interface), Krita completely freezes, requiring a forced restart. Every boot-up of Krita after this freezes almost immediately, requiring me to shut down ComfyUI then boot up Krita again.

One observed behaviour with this freeze is that Krita will 100% one of my CPU's threads.

Viewing the logs, I see an error about unet_gguf's folder not being set up correctly, but this error message shows up for Krita Diffusion even without connecting to the ComfyUI backend, and I see 47 other instances of that error message in the past (before this freezing problem), so I'm pretty sure it's unrelated:

2025-05-22 19:06:44,731 INFO Optional LoRA lcm for SD 1.5 not found (search path: lcm-lora-sdv1-5.safetensors, lcm/sd1.5/pytorch_lora_weights.safetensors)
2025-05-22 19:06:44,731 INFO Optional LoRA lcm for SD XL not found (search path: lcm-lora-sdxl.safetensors, lcm/sdxl/pytorch_lora_weights.safetensors)
2025-05-22 19:06:44,731 INFO Optional LoRA face for SD 1.5 not found (search path: ip-adapter-faceid-plusv2_sd15_lora, ip-adapter-faceid-plus_sd15_lora)
2025-05-22 19:06:44,731 INFO Optional LoRA face for SD XL not found (search path: ip-adapter-faceid-plusv2_sdxl_lora, ip-adapter-faceid_sdxl_lora)
2025-05-22 19:06:44,731 INFO Optional LoRA lightning for SD XL not found (search path: sdxl_lightning_8step_lora)
2025-05-22 19:06:44,731 INFO Optional LoRA depth for Flux not found (search path: flux1-depth)
2025-05-22 19:06:44,731 INFO Optional LoRA canny_edge for Flux not found (search path: flux1-canny)
2025-05-22 19:06:45,146 ERROR Error while inspecting models in unet_gguf: Invalid folder path, must be one of checkpoints, configs, loras, vae, text_encoders, diffusion_models, clip_vision, style_models, embeddings, diffusers, vae_approx, controlnet, gligen, upscale_models, custom_nodes, hypernetworks, photomaker, classifiers, ultralytics_bbox, ultralytics_segm, ultralytics, mmdets_bbox, mmdets_segm, mmdets, sams, onnx, instantid, pulid, layer_model, rembg, ipadapter, dynamicrafter_models, mediapipe, inpaint, prompt_generator, t5, llm (Error transferring http://127.0.0.1:8188/api/etn/model_info/unet_gguf - server replied: Bad Request)
2025-05-22 19:06:45,147 INFO GGUF support: node is not installed.
2025-05-22 19:06:45,147 INFO SD 1.5: missing 1 models
2025-05-22 19:06:45,147 INFO SD XL: missing 1 models
2025-05-22 19:06:45,147 INFO SD 3: missing 3 models
2025-05-22 19:06:45,147 INFO Flux: missing 1 models
2025-05-22 19:06:45,147 INFO Supported workloads: Illustrious, Illustrious v-prediction

It's possibly the workflow I'm using, but no matter what workflow I use it has the same freezing problem. Here it is if you'd like to try your hand at reproducing this issue: inpainter-LATEST2.json

If you can please let me know all the places where I'd be able to find log information (perhaps Krita's entire log rather than Krita Diffusion's), then I think I'd be able to diagnose this issue better.

ArgentVASIMR avatar May 22 '25 12:05 ArgentVASIMR

Any chance it can be reproduced with a workflow without (so many) custom nodes?

I doubt there is more logs that help, it might be generating the parameter UI triggers some kind of infinite loop. Probably easier to see in a debugger.

Acly avatar May 22 '25 13:05 Acly

Turned out it was an infinite loop in the ComfyUI workflow! upscale image using model #42 and Scale Image to Total Pixels #30 were the culprits.

I do wonder if Krita Diffusion could be built with some sort of handling for this? When loading the workflow, if Krita Diffusion detects the same node (by ID number, not same type) being accessed X times across Y total node loading (not necessarily twice in a row; I can see the same node being used multiple times in a workflow being intentional), it halts the loop, disconnects from the ComfyUI backend, then spits an error at the user for what number node they need to look at. Would allow Krita to still be usable and helps foolproof against future infinite loops like this in other users' workflows.

ArgentVASIMR avatar May 22 '25 23:05 ArgentVASIMR

I can see the same node being used multiple times in a workflow being intentional)

I don't think this is allowed in ComfyUI (you can create loops in the web UI, but you'll get an error when trying to run them)

Hang is fixed in v1.35.0

Acly avatar May 24 '25 18:05 Acly