Comfy-Org / Comfy-Org/ComfyUI

ComfyUI mantains too many opened connections, causing connection pool depletion

Open
#9,632 0 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

-

### Actual Behavior

-

### Steps to Reproduce

Ran with fresh python 3.12 installation (mamba) and torch 2.8+cu129
Flags --highvr --listen
--disable-all-custom-nodes, ofc
Started 100+ images queue (batch 4)
Eventually webapp freezes

### Debug Logs

```powershell
... (lots of OSError 24)
Traceback (most recent call last):
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/asyncio/selector_events.py", line 178, in _accept_connection
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/socket.py", line 295, in accept
OSError: [Errno 24] Too many open files
socket.accept() out of system resource
socket:
Traceback (most recent call last):
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/asyncio/selector_events.py", line 178, in _accept_connection
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/socket.py", line 295, in accept
OSError: [Errno 24] Too many open files

^C

Stopped server
Exception ignored in atexit callback: >
Traceback (most recent call last):
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/tempfile.py", line 954, in cleanup
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/tempfile.py", line 934, in _rmtree
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/shutil.py", line 759, in rmtree
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/shutil.py", line 703, in _rmtree_safe_fd
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/shutil.py", line 674, in _rmtree_safe_fd
OSError: [Errno 24] Too many open files: '/tmp/tmpe898v6w5'
Exception ignored in atexit callback:
Traceback (most recent call last):
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/site-packages/torch/_dynamo/utils.py", line 811, in dump_compile_times
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/site-packages/torch/_dynamo/utils.py", line 797, in compile_times
File "/home/pl752/mambaforge/envs/comfy/lib/python3.12/site-packages/torch/_dynamo/utils.py", line 226, in tabulate
File "", line 1360, in _find_and_load
File "", line 1322, in _find_and_load_unlocked
File "", line 1262, in _find_spec
File "", line 1532, in find_spec
File "", line 1506, in _get_spec
File "", line 1609, in find_spec
File "", line 1652, in _fill_cache
OSError: [Errno 24] Too many open files: '/home/pl752/ComfyUI'
```

### Other

lsof segment
```
python 6652 6734 python pl752 559u IPv4 60357 0t0 TCP pl752-desktop:8188->192.168.1.65:56492 (ESTABLISHED)
python 6652 6734 python pl752 560u IPv4 60359 0t0 TCP pl752-desktop:8188->192.168.1.65:56493 (ESTABLISHED)
python 6652 6734 python pl752 561u IPv4 60360 0t0 TCP pl752-desktop:8188->192.168.1.65:56494 (ESTABLISHED)
python 6652 6734 python pl752 562u IPv4 60361 0t0 TCP pl752-desktop:8188->192.168.1.65:56495 (ESTABLISHED)
python 6652 6734 python pl752 563u IPv4 60362 0t0 TCP pl752-desktop:8188->192.168.1.65:56496 (ESTABLISHED)
python 6652 6734 python pl752 564u IPv4 60373 0t0 TCP pl752-desktop:8188->192.168.1.65:56508 (ESTABLISHED)
python 6652 6734 python pl752 565u IPv4 60354 0t0 TCP pl752-desktop:8188->192.168.1.65:56491 (ESTABLISHED)
python 6652 6734 python pl752 566u IPv4 60355 0t0 TCP pl752-desktop:8188->192.168.1.65:56490 (ESTABLISHED)
python 6652 6734 python pl752 567u IPv4 60374 0t0 TCP pl752-desktop:8188->192.168.1.65:56509 (ESTABLISHED)
python 6652 6734 python pl752 568u IPv4 60371 0t0 TCP pl752-desktop:8188->192.168.1.65:56505 (ESTABLISHED)
python 6652 6734 python pl752 569u IPv4 60376 0t0 TCP pl752-desktop:8188->192.168.1.65:56510 (ESTABLISHED)
python 6652 6734 python pl752 570u IPv4 60364 0t0 TCP pl752-desktop:8188->192.168.1.65:56497 (ESTABLISHED)
python 6652 6734 python pl752 571u IPv4 60366 0t0 TCP pl752-desktop:8188->192.168.1.65:56498 (ESTABLISHED)
python 6652 6734 python pl752 572u IPv4 60368 0t0 TCP pl752-desktop:8188->192.168.1.65:56499 (ESTABLISHED)
python 6652 6734 python pl752 573u IPv4 60369 0t0 TCP pl752-desktop:8188->192.168.1.65:56500 (ESTABLISHED)
python 6652 6734 python pl752 574u IPv4 99319 0t0 TCP pl752-desktop:8188->192.168.1.65:56516 (ESTABLISHED)
python 6652 6734 python pl752 575u IPv4 60378 0t0 TCP pl752-desktop:8188->192.168.1.65:56511 (ESTABLISHED)
python 6652 6734 python pl752 576u IPv4 60379 0t0 TCP pl752-desktop:8188->192.168.1.65:56512 (ESTABLISHED)
python 6652 6734 python pl752 577u IPv4 60380 0t0 TCP pl752-desktop:8188->192.168.1.65:56513 (ESTABLISHED)
python 6652 6734 python pl752 578u IPv4 60382 0t0 TCP pl752-desktop:8188->192.168.1.65:56514 (ESTABLISHED)
python 6652 6734 python pl752 579u IPv4 99320 0t0 TCP pl752-desktop:8188->192.168.1.65:56517 (ESTABLISHED)
python 6652 6734 python pl752 580u IPv4 99322 0t0 TCP pl752-desktop:8188->192.168.1.65:56518 (ESTABLISHED)
python 6652 6734 python pl752 581u IPv4 60383 0t0 TCP pl752-desktop:8188->192.168.1.65:56515 (ESTABLISHED)
python 6652 6734 python pl752 582u IPv4 363936 0t0 TCP pl752-desktop:8188->192.168.1.65:56526 (ESTABLISHED)
python 6652 6734 python pl752 583u IPv4 99324 0t0 TCP pl752-desktop:8188->192.168.1.65:56519 (ESTABLISHED)
```

browser log
user.css:1


Failed to load resource: the server responded with a status of 404 (Not Found)
user.css:1


Failed to load resource: the server responded with a status of 404 (Not Found)
index-JxNRA6lV.js:sourcemap:95334 Running on 192.168.1.33:8188
index-JxNRA6lV.js:sourcemap:309067 ComfyUI Front-end version: 1.25.11
index-JxNRA6lV.js:sourcemap:246589 Attempted to cleanup event listeners for graph that was never set up
cleanupEventListeners @ index-JxNRA6lV.js:sourcemap:246589
:8188/api/customnode/installed:1


Failed to load resource: the server responded with a status of 404 (Not Found)
index-JxNRA6lV.js:sourcemap:95531 Server feature flags received: Object
192.168.1.33/:1 The file at 'http://192.168.1.33:8188/api/view?filename=ComfyUI_temp_kemsd_00008_.png&subfolder=&type=temp&rand=0.840485130691259' was loaded over an insecure connection. This file should be served over HTTPS.
192.168.1.33/:1 The file at 'http://192.168.1.33:8188/api/view?filename=ComfyUI_temp_kemsd_00005_.png&subfolder=&type=temp&rand=0.840485130691259' was loaded over an insecure connection. This file should be served over HTTPS.
192.168.1.33/:1 The file at 'http://192.168.1.33:8188/api/view?filename=ComfyUI_temp_kemsd_00010_.png&subfolder=&type=temp&rand=0.32207169440185324' was loaded over an insecure connection. This file should be served over HTTPS.
192.168.1.33/:1 The file at 'http://192.168.1.33:8188/api/view?filename=ComfyUI_temp_kemsd_00014_.png&subfolder=&type=temp&rand=0.5690646269198992' was loaded over an insecure connection. This file should be served over HTTPS.
user.css:1


Failed to load resource: the server responded with a status of 404 (Not Found)
user.css:1


Failed to load resource: the server responded with a status of 404 (Not Found)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.