Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComfyUI cli returns 500 server erorr, TimeoutError: timed out. #861

Open
florisvanderharst opened this issue Sep 2, 2024 · 1 comment
Open

Comments

@florisvanderharst
Copy link

While running the comfyapp.py and running the comfyclient.py locally - I'm getting errors while the same workflow works in the UI.

After running with verbose on, we do see that comfy is indeed running.

Executing workflow: /root/47c2edb7f48f4d4b9f64bd327951b733.json
Executing : Cascade Resolutions - CascadeResolutions (53)
Executing : Load Checkpoint - CheckpointLoaderSimple (153)
Executing : Lora Loader Stack (rgthree) (186)
Executing : ModelSamplingFlux (55)
Executing : description of the scene - CLIPTextEncodeFlux (89)
Executing : CLIP Text Encode (Prompt) - CLIPTextEncode (35)
Executing : ConditioningZeroOut (56)
Executing : Empty Latent Image - EmptyLatentImage (5)
Executing : KSampler (32)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━             73% 0:00:49  

but errors out randomly after.

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.11/site-packages/websocket/_socket.py:118 in recv     │
│                                                                              │
│   115 │   │   if sock.gettimeout() == 0:                                     │
│   116 │   │   │   bytes_ = sock.recv(bufsize)                                │
│   117 │   │   else:                                                          │
│ ❱ 118 │   │   │   bytes_ = _recv()                                           │
│   119 │   except TimeoutError:                                               │
│   120 │   │   raise WebSocketTimeoutException("Connection timed out")        │
│   121 │   except socket.timeout as e:                                        │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │   _recv = <function recv.<locals>._recv at 0x7fc6685dd620>               │ │
│ │ bufsize = 2                                                              │ │
│ │    sock = <socket.socket fd=4, family=2, type=1, proto=6,                │ │
│ │           laddr=('127.0.0.1', 41828), raddr=('127.0.0.1', 8188)>         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_socket.py:97 in _recv     │
│                                                                              │
│    94 │                                                                      │
│    95 │   def _recv():                                                       │
│    96 │   │   try:                                                           │
│ ❱  97 │   │   │   return sock.recv(bufsize)                                  │
│    98 │   │   except SSLWantReadError:                                       │
│    99 │   │   │   pass                                                       │
│   100 │   │   except socket.error as exc:                                    │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │    bufsize = 2                                                           │ │
│ │ error_code = None                                                        │ │
│ │       sock = <socket.socket fd=4, family=2, type=1, proto=6,             │ │
│ │              laddr=('127.0.0.1', 41828), raddr=('127.0.0.1', 8188)>      │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutError: timed out

During handling of the above exception, another exception occurred:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.11/site-packages/comfy_cli/tracking.py:88 in wrapper  │
│                                                                              │
│    85 │   │   │   )                                                          │
│    86 │   │   │   track_event(command_name, properties=filtered_kwargs)      │
│    87 │   │   │                                                              │
│ ❱  88 │   │   │   return func(*args, **kwargs)                               │
│    89 │   │                                                                  │
│    90 │   │   return wrapper                                                 │
│    91                                                                        │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │            args = ()                                                     │ │
│ │    command_name = 'run'                                                  │ │
│ │ filtered_kwargs = {                                                      │ │
│ │                   │   'workflow':                                        │ │
│ │                   '/root/47c2edb7f48f4d4b9f64bd327951b733.json',         │ │
│ │                   │   'wait': True,                                      │ │
│ │                   │   'verbose': True,                                   │ │
│ │                   │   'host': None,                                      │ │
│ │                   │   'port': None,                                      │ │
│ │                   │   'cli_version': '1.0.33',                           │ │
│ │                   │   'tracing_id':                                      │ │
│ │                   'e5ff0bac-c1e7-467b-8bca-dfb91c9c1a68'                 │ │
│ │                   }                                                      │ │
│ │            func = <function run at 0x7fc6685a6840>                       │ │
│ │          kwargs = {                                                      │ │
│ │                   │   'workflow':                                        │ │
│ │                   '/root/47c2edb7f48f4d4b9f64bd327951b733.json',         │ │
│ │                   │   'wait': True,                                      │ │
│ │                   │   'verbose': True,                                   │ │
│ │                   │   'host': None,                                      │ │
│ │                   │   'port': None                                       │ │
│ │                   }                                                      │ │
│ │     sub_command = None                                                   │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/comfy_cli/cmdline.py:410 in run      │
│                                                                              │
│   407 │   if not port:                                                       │
│   408 │   │   port = 8188                                                    │
│   409 │                                                                      │
│ ❱ 410 │   run_inner.execute(workflow, host, port, wait, verbose, local_paths │
│   411                                                                        │
│   412                                                                        │
│   413 def validate_comfyui(_env_checker):                                    │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      config = <comfy_cli.config_manager.ConfigManager object at          │ │
│ │               0x7fc6688c2550>                                            │ │
│ │        host = '127.0.0.1'                                                │ │
│ │ local_paths = True                                                       │ │
│ │        port = 8188                                                       │ │
│ │     verbose = True                                                       │ │
│ │        wait = True                                                       │ │
│ │    workflow = '/root/47c2edb7f48f4d4b9f64bd327951b733.json'              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/comfy_cli/command/run.py:75 in       │
│ execute                                                                      │
│                                                                              │
│    72 │   │   │   execution.connect()                                        │
│    73 │   │   execution.queue()                                              │
│    74 │   │   if wait:                                                       │
│ ❱  75 │   │   │   execution.watch_execution()                                │
│    76 │   │   │   end = time.time()                                          │
│    77 │   │   │   progress.stop()                                            │
│    78 │   │   │   progress = None                                            │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │     execution = <comfy_cli.command.run.WorkflowExecution object at       │ │
│ │                 0x7fc6685da350>                                          │ │
│ │          host = '127.0.0.1'                                              │ │
│ │   local_paths = True                                                     │ │
│ │          port = 8188                                                     │ │
│ │      progress = <comfy_cli.command.run.ExecutionProgress object at       │ │
│ │                 0x7fc6685f8dd0>                                          │ │
│ │         start = 1725268972.5496752                                       │ │
│ │       verbose = True                                                     │ │
│ │          wait = True                                                     │ │
│ │      workflow = {                                                        │ │
│ │                 │   '5': {                                               │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'width': ['53', 0],                          │ │
│ │                 │   │   │   'height': ['53', 1],                         │ │
│ │                 │   │   │   'batch_size': 1                              │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'EmptyLatentImage',                │ │
│ │                 │   │   '_meta': {'title': 'Empty Latent Image'}         │ │
│ │                 │   },                                                   │ │
│ │                 │   '29': {                                              │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'samples': ['32', 0],                        │ │
│ │                 │   │   │   'vae': ['153', 2]                            │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'VAEDecode',                       │ │
│ │                 │   │   '_meta': {'title': 'VAE Decode'}                 │ │
│ │                 │   },                                                   │ │
│ │                 │   '30': {                                              │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'filename_prefix':                           │ │
│ │                 '47c2edb7f48f4d4b9f64bd327951b733',                      │ │
│ │                 │   │   │   'images': ['29', 0]                          │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'SaveImage',                       │ │
│ │                 │   │   '_meta': {'title': 'Save Image'}                 │ │
│ │                 │   },                                                   │ │
│ │                 │   '32': {                                              │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'seed': 1009516466755283,                    │ │
│ │                 │   │   │   'steps': 20,                                 │ │
│ │                 │   │   │   'cfg': 1,                                    │ │
│ │                 │   │   │   'sampler_name': 'dpmpp_2m',                  │ │
│ │                 │   │   │   'scheduler': 'sgm_uniform',                  │ │
│ │                 │   │   │   'denoise': 1,                                │ │
│ │                 │   │   │   'model': ['55', 0],                          │ │
│ │                 │   │   │   'positive': ['89', 0],                       │ │
│ │                 │   │   │   'negative': ['56', 0],                       │ │
│ │                 │   │   │   'latent_image': ['5', 0]                     │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'KSampler',                        │ │
│ │                 │   │   '_meta': {'title': 'KSampler'}                   │ │
│ │                 │   },                                                   │ │
│ │                 │   '35': {                                              │ │
│ │                 │   │   'inputs': {'text': '', 'clip': ['186', 1]},      │ │
│ │                 │   │   'class_type': 'CLIPTextEncode',                  │ │
│ │                 │   │   '_meta': {                                       │ │
│ │                 │   │   │   'title': 'CLIP Text Encode (Prompt)'         │ │
│ │                 │   │   }                                                │ │
│ │                 │   },                                                   │ │
│ │                 │   '53': {                                              │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'size_selected': '1920x1152 (5:3) - Wide     │ │
│ │                 Large',                                                  │ │
│ │                 │   │   │   'multiply_factor': 1,                        │ │
│ │                 │   │   │   'manual_width': 0,                           │ │
│ │                 │   │   │   'manual_height': 0                           │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'CascadeResolutions',              │ │
│ │                 │   │   '_meta': {'title': 'Cascade Resolutions'}        │ │
│ │                 │   },                                                   │ │
│ │                 │   '55': {                                              │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'max_shift': 0.8,                            │ │
│ │                 │   │   │   'base_shift': 0.4,                           │ │
│ │                 │   │   │   'width': ['53', 0],                          │ │
│ │                 │   │   │   'height': ['53', 1],                         │ │
│ │                 │   │   │   'model': ['186', 0]                          │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'ModelSamplingFlux',               │ │
│ │                 │   │   '_meta': {'title': 'ModelSamplingFlux'}          │ │
│ │                 │   },                                                   │ │
│ │                 │   '56': {                                              │ │
│ │                 │   │   'inputs': {'conditioning': ['35', 0]},           │ │
│ │                 │   │   'class_type': 'ConditioningZeroOut',             │ │
│ │                 │   │   '_meta': {'title': 'ConditioningZeroOut'}        │ │
│ │                 │   },                                                   │ │
│ │                 │   '89': {                                              │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'clip_l': '',                                │ │
│ │                 │   │   │   't5xxl': 'what a test text',                 │ │
│ │                 │   │   │   'guidance': 3.5,                             │ │
│ │                 │   │   │   'clip': ['186', 1]                           │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'CLIPTextEncodeFlux',              │ │
│ │                 │   │   '_meta': {'title': 'description of the scene'}   │ │
│ │                 │   },                                                   │ │
│ │                 │   '153': {                                             │ │
│ │                 │   │   'inputs': {                                      │ │
│ │                 │   │   │   'ckpt_name': 'flux1-dev-fp8.safetensors'     │ │
│ │                 │   │   },                                               │ │
│ │                 │   │   'class_type': 'CheckpointLoaderSimple',          │ │
│ │                 │   │   '_meta': {'title': 'Load Checkpoint'}            │ │
│ │                 │   },                                                   │ │
│ │                 │   ... +1                                               │ │
│ │                 }                                                        │ │
│ │ workflow_name = '/root/47c2edb7f48f4d4b9f64bd327951b733.json'            │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/comfy_cli/command/run.py:176 in      │
│ watch_execution                                                              │
│                                                                              │
│   173 │   def watch_execution(self):                                         │
│   174 │   │   self.ws.settimeout(30)                                         │
│   175 │   │   while True:                                                    │
│ ❱ 176 │   │   │   message = self.ws.recv()                                   │
│   177 │   │   │   if isinstance(message, str):                               │
│   178 │   │   │   │   message = json.loads(message)                          │
│   179 │   │   │   │   if not self.on_message(message):                       │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ message = {                                                              │ │
│ │           │   'type': 'executing',                                       │ │
│ │           │   'data': {                                                  │ │
│ │           │   │   'node': '32',                                          │ │
│ │           │   │   'display_node': '32',                                  │ │
│ │           │   │   'prompt_id': '0e9ff7ea-4243-4243-8d25-32806b379314'    │ │
│ │           │   }                                                          │ │
│ │           }                                                              │ │
│ │    self = <comfy_cli.command.run.WorkflowExecution object at             │ │
│ │           0x7fc6685da350>                                                │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_core.py:388 in recv       │
│                                                                              │
│   385 │   │   data: string (byte array) value.                               │
│   386 │   │   """                                                            │
│   387 │   │   with self.readlock:                                            │
│ ❱ 388 │   │   │   opcode, data = self.recv_data()                            │
│   389 │   │   if opcode == ABNF.OPCODE_TEXT:                                 │
│   390 │   │   │   data_received: Union[bytes, str] = data                    │
│   391 │   │   │   if isinstance(data_received, bytes):                       │
│                                                                              │
│ ╭────────────────────────── locals ───────────────────────────╮              │
│ │ self = <websocket._core.WebSocket object at 0x7fc6685da450> │              │
│ ╰─────────────────────────────────────────────────────────────╯              │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_core.py:416 in recv_data  │
│                                                                              │
│   413 │   │   opcode, frame.data: tuple                                      │
│   414 │   │   │   tuple of operation code and string(byte array) value.      │
│   415 │   │   """                                                            │
│ ❱ 416 │   │   opcode, frame = self.recv_data_frame(control_frame)            │
│   417 │   │   return opcode, frame.data                                      │
│   418 │                                                                      │
│   419 │   def recv_data_frame(self, control_frame: bool = False) -> tuple:   │
│                                                                              │
│ ╭─────────────────────────────── locals ───────────────────────────────╮     │
│ │ control_frame = False                                                │     │
│ │          self = <websocket._core.WebSocket object at 0x7fc6685da450> │     │
│ ╰──────────────────────────────────────────────────────────────────────╯     │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_core.py:437 in            │
│ recv_data_frame                                                              │
│                                                                              │
│   434 │   │   │   tuple of operation code and string(byte array) value.      │
│   435 │   │   """                                                            │
│   436 │   │   while True:                                                    │
│ ❱ 437 │   │   │   frame = self.recv_frame()                                  │
│   438 │   │   │   if isEnabledForTrace():                                    │
│   439 │   │   │   │   trace(f"++Rcv raw: {repr(frame.format())}")            │
│   440 │   │   │   │   trace(f"++Rcv decoded: {frame.__str__()}")             │
│                                                                              │
│ ╭─────────────────────────────── locals ───────────────────────────────╮     │
│ │ control_frame = False                                                │     │
│ │          self = <websocket._core.WebSocket object at 0x7fc6685da450> │     │
│ ╰──────────────────────────────────────────────────────────────────────╯     │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_core.py:478 in recv_frame │
│                                                                              │
│   475 │   │   -------                                                        │
│   476 │   │   self.frame_buffer.recv_frame(): ABNF frame object              │
│   477 │   │   """                                                            │
│ ❱ 478 │   │   return self.frame_buffer.recv_frame()                          │
│   479 │                                                                      │
│   480 │   def send_close(self, status: int = STATUS_NORMAL, reason: bytes =  │
│   481 │   │   """                                                            │
│                                                                              │
│ ╭────────────────────────── locals ───────────────────────────╮              │
│ │ self = <websocket._core.WebSocket object at 0x7fc6685da450> │              │
│ ╰─────────────────────────────────────────────────────────────╯              │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_abnf.py:363 in recv_frame │
│                                                                              │
│   360 │   │   with self.lock:                                                │
│   361 │   │   │   # Header                                                   │
│   362 │   │   │   if self.has_received_header():                             │
│ ❱ 363 │   │   │   │   self.recv_header()                                     │
│   364 │   │   │   (fin, rsv1, rsv2, rsv3, opcode, has_mask, _) = self.header │
│   365 │   │   │                                                              │
│   366 │   │   │   # Frame length                                             │
│                                                                              │
│ ╭──────────────────────────── locals ────────────────────────────╮           │
│ │ self = <websocket._abnf.frame_buffer object at 0x7fc6685dae90> │           │
│ ╰────────────────────────────────────────────────────────────────╯           │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_abnf.py:319 in            │
│ recv_header                                                                  │
│                                                                              │
│   316 │   │   return self.header is None                                     │
│   317 │                                                                      │
│   318 │   def recv_header(self) -> None:                                     │
│ ❱ 319 │   │   header = self.recv_strict(2)                                   │
│   320 │   │   b1 = header[0]                                                 │
│   321 │   │   fin = b1 >> 7 & 1                                              │
│   322 │   │   rsv1 = b1 >> 6 & 1                                             │
│                                                                              │
│ ╭──────────────────────────── locals ────────────────────────────╮           │
│ │ self = <websocket._abnf.frame_buffer object at 0x7fc6685dae90> │           │
│ ╰────────────────────────────────────────────────────────────────╯           │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_abnf.py:398 in            │
│ recv_strict                                                                  │
│                                                                              │
│   395 │   │   │   # yet passing large numbers repeatedly causes lots of larg │
│   396 │   │   │   # buffers allocated and then shrunk, which results in      │
│   397 │   │   │   # fragmentation.                                           │
│ ❱ 398 │   │   │   bytes_ = self.recv(min(16384, shortage))                   │
│   399 │   │   │   self.recv_buffer.append(bytes_)                            │
│   400 │   │   │   shortage -= len(bytes_)                                    │
│   401                                                                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │  bufsize = 2                                                       │       │
│ │     self = <websocket._abnf.frame_buffer object at 0x7fc6685dae90> │       │
│ │ shortage = 2                                                       │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_core.py:563 in _recv      │
│                                                                              │
│   560 │                                                                      │
│   561 │   def _recv(self, bufsize):                                          │
│   562 │   │   try:                                                           │
│ ❱ 563 │   │   │   return recv(self.sock, bufsize)                            │
│   564 │   │   except WebSocketConnectionClosedException:                     │
│   565 │   │   │   if self.sock:                                              │
│   566 │   │   │   │   self.sock.close()                                      │
│                                                                              │
│ ╭──────────────────────────── locals ────────────────────────────╮           │
│ │ bufsize = 2                                                    │           │
│ │    self = <websocket._core.WebSocket object at 0x7fc6685da450> │           │
│ ╰────────────────────────────────────────────────────────────────╯           │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/websocket/_socket.py:120 in recv     │
│                                                                              │
│   117 │   │   else:                                                          │
│   118 │   │   │   bytes_ = _recv()                                           │
│   119 │   except TimeoutError:                                               │
│ ❱ 120 │   │   raise WebSocketTimeoutException("Connection timed out")        │
│   121 │   except socket.timeout as e:                                        │
│   122 │   │   message = extract_err_message(e)                               │
│   123 │   │   raise WebSocketTimeoutException(message)                       │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │   _recv = <function recv.<locals>._recv at 0x7fc6685dd620>               │ │
│ │ bufsize = 2                                                              │ │
│ │    sock = <socket.socket fd=4, family=2, type=1, proto=6,                │ │
│ │           laddr=('127.0.0.1', 41828), raddr=('127.0.0.1', 8188)>         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
WebSocketTimeoutException: Connection timed out
Traceback (most recent call last):
  File "/pkg/modal/_container_io_manager.py", line 727, in handle_input_exception
    yield
  File "/pkg/modal/_container_entrypoint.py", line 349, in run_input_async
    async for value in res:
  File "/pkg/modal/_asgi.py", line 128, in fn
    app_task.result()  # consume/raise exceptions if there are any!
    ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 235, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/comfyapp.py", line 125, in api
    img_bytes = self.infer.local(new_workflow_file)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pkg/modal/functions.py", line 1319, in local
    return fun(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/root/comfyapp.py", line 79, in infer
    subprocess.run(cmd, shell=True, check=True)
  File "/usr/local/lib/python3.11/subprocess.py", line 569, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'comfy run --workflow "/root/47c2edb7f48f4d4b9f64bd327951b733.json" --wait --verbose' returned non-zero exit status 1.

Looks like it timeouts for bigger models, e.g. flux1-dev-fp8.safetensors while the original example works correctly. The modified workflow however works perfectly in the UI.

Super confused, would love to get some help.

@kning
Copy link
Contributor

kning commented Oct 22, 2024

thanks for the detailed log messages. i've also heard of this happening to some others in our Slack channel. my hunch is that something buggy is happening with comfy run --workflow from comfy-cli where the websocket connection with the running comfyui server is getting lost. some users have talked about workarounds where they avoid websocket entirely and just trigger workflow runs / poll for requests using http. in any case, i'm also going to file an issue with comfy-cli if they have other insight.

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

No branches or pull requests

2 participants