Skip to content

Conversation

@majiayu000
Copy link

Summary

  • Close image file handles after loading in LoadImage and LoadImageMask nodes

Fixes

Closes #3477

Problem

Image files were opened but not closed, keeping file handles open and
preventing other processes from accessing the files.

Solution

Added try/finally blocks to ensure img.close() is called after processing.

Test

Added tests-unit/test_load_image_file_handle.py

Fixes comfyanonymous#3477

The LoadImage and LoadImageMask nodes opened image files but did not
close them after processing. This kept file handles open, preventing
other processes from accessing the files.

Added try/finally blocks to ensure img.close() is called after
processing completes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

close image file after loading?

1 participant