Skip to content

cli_eval: Multiple AsyncSqliteSaver instances operating on a single file #222

@andrei-rusu

Description

@andrei-rusu

_runtime.py: async with AsyncSqliteSaver.from_conn_string(...) as memory is executed for every LangGraphRuntime. This creates new aiosqlite connections, each of which being assigned a separate asyncio.Lock. The problem is that each of these connections operates on a single shared file __uipath/state.db. As such, when running with multiple workers, racing conditions can occur at write time (signalled via sqlite3.OperationalError: database is locked).

Possible solutions:

  • Create separate DB files for each run item. For example in uipath._cli._runtime._contracts>>UiPathBaseRuntime.state_file_path, we can change the return to something like os.path.join(base_dir, f"eval_run_{id}.db") if is_eval_run is True.
  • Create the lock ahead of the eval set loop. We could pass the lock (or the memory instance) from outside the loop, but make it Optional such that we can create a new connection with its own lock for uipath run etc.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions