_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.