Comfy-Org / Comfy-Org/ComfyUI

Input/output error in logger.py when printing from a custom node

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

Description

### Expected Behavior

ComfyUI does not crash.

### Actual Behavior

ComfyUI crashes with the following message (path names have been mangled for own reasons, don't be worried if these are inconsistent, the log message comes from comfy), after some time it has been running on macos. I don't know if the same is true for other systems and I'm not sure this happens after suspend, but not always, apparently, anyway.

What I'm doing in particular which might affect stdout/stdin hijacking is launching ComfyUI from another python script, like this:

```
os.chdir(os.path.join(repo_dir, "ComfyUI"))
print("Starting ComfyUI... ", sys.executable)
subprocess.run(
[
sys.executable,
"main.py",
"--enable-cors-header",
"*",
"--force-fp16",
"--preview-method=none",
]
)
```

Will mention @pythongosssss because I guess the hijacking code comes from them, sorry if I'm mistaken.

```
[Errno 5] Input/output error
File "/home/vincenzo/ComfyUI/execution.py", line 327, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
, File "/home/vincenzo/ComfyUI/execution.py", line 202, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
, File "/home/vincenzo/ComfyUI/execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
, File "/home/vincenzo/ComfyUI/execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
, File "/home/vincenzo/ComfyUI/custom_nodes/vincenzo-comfy-nodes/vincenzo_checkpoint_fetcher.py", line 229, in download_model
print("download model", type(url), url)
, File "/home/vincenzo/ComfyUI/app/logger.py", line 32, in write
super().write(data)
```

### Steps to Reproduce

Not sure how to reproduce.

### Debug Logs

```powershell
[Errno 5] Input/output error
File "/home/vincenzo/ComfyUI/execution.py", line 327, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
, File "/home/vincenzo/ComfyUI/execution.py", line 202, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
, File "/home/vincenzo/ComfyUI/execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
, File "/home/vincenzo/ComfyUI/execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
, File "/home/vincenzo/ComfyUI/custom_nodes/vincenzo-comfy-nodes/vincenzo_checkpoint_fetcher.py", line 229, in download_model
print("download model", type(url), url)
, File "/home/vincenzo/ComfyUI/app/logger.py", line 32, in write
super().write(data)
```

### Other

_No response_

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.