Skip to content

[bug]: reproducible nodes engine soft lock with collect/iterate nodes #3222

@psychedelicious

Description

@psychedelicious

Is there an existing issue for this?

  • I have searched the existing issues

OS

Linux

GPU

cuda

VRAM

24GB

What version did you experience this issue on?

feat/ui/nodes-api

What happened?

When using collection/iterate nodes incorrectly - two times in a row - it is possible to soft lock the nodes engine. The API still responds but it does not generate until restarting.

This is the error (no error is emitted via events):

{'type': 'int_collection', 'collection': [1826701614]}
Exception in thread invoker_processor:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/services/processor.py", line 123, in __process
    self.__invoker.invoke(graph_execution_state, invoke_all=True)
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/services/invoker.py", line 28, in invoke
    invocation = graph_execution_state.next()
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/services/graph.py", line 817, in next
    prepared_id = self._prepare()
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/services/graph.py", line 1026, in _prepare
    create_results = self._create_execution_node(next_node_id, iteration_mappings)  # type: ignore
  File "/home/bat/Documents/Code/InvokeAI/invokeai/app/services/graph.py", line 876, in _create_execution_node
    input_collection_edge = next(
StopIteration

To reproduce, connect a range output to the index input of an iterate node, invoke all, then make a new session and do it again. The above error is output each time, but it's only on the second invoke all that the engine stops executing.

Example malformed graph_execution_state (use the simple source graph to reproduce - run the graph twice, changing its ID between runs):

{
  "id": "9d060c16-e8c3-4817-9ec7-17e47b423ae9",
  "graph": {
    "id": "e4bf01c2-10ce-4b93-b247-ac7d0016c59b",
    "nodes": {
      "f4372771-1866-4119-929a-b735478e54f1": {
        "id": "f4372771-1866-4119-929a-b735478e54f1",
        "type": "random_range",
        "low": 0,
        "high": 2147483647,
        "size": 1,
        "seed": 0
      },
      "955935df-ee3c-4cdc-befd-7985f9f83347": {
        "id": "955935df-ee3c-4cdc-befd-7985f9f83347",
        "type": "iterate",
        "collection": [],
        "index": 0
      }
    },
    "edges": [
      {
        "source": {
          "node_id": "f4372771-1866-4119-929a-b735478e54f1",
          "field": "collection"
        },
        "destination": {
          "node_id": "955935df-ee3c-4cdc-befd-7985f9f83347",
          "field": "index"
        }
      }
    ]
  },
  "execution_graph": {
    "id": "3ce1b403-2506-419c-9ee1-28a4524bd95b",
    "nodes": {
      "b332dc93-3a72-4994-80fd-208cec63be28": {
        "id": "b332dc93-3a72-4994-80fd-208cec63be28",
        "type": "random_range",
        "low": 0,
        "high": 2147483647,
        "size": 1,
        "seed": 0
      }
    },
    "edges": []
  },
  "executed": [
    "f4372771-1866-4119-929a-b735478e54f1",
    "b332dc93-3a72-4994-80fd-208cec63be28"
  ],
  "executed_history": ["f4372771-1866-4119-929a-b735478e54f1"],
  "results": {
    "b332dc93-3a72-4994-80fd-208cec63be28": {
      "type": "int_collection",
      "collection": [1826701614]
    }
  },
  "errors": {},
  "prepared_source_mapping": {
    "b332dc93-3a72-4994-80fd-208cec63be28": "f4372771-1866-4119-929a-b735478e54f1"
  },
  "source_prepared_mapping": {
    "f4372771-1866-4119-929a-b735478e54f1": [
      "b332dc93-3a72-4994-80fd-208cec63be28"
    ]
  }
}

Screenshots

No response

Additional context

No response

Contact Details

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions