mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
`LazyTool` materialise during workflow ``inject_all`` calls ``store.get(hash)``; the store ran the SELECT on Galaxy's shared scoped session and then called ``session.rollback()`` to release the implicit read transaction. That rollback expired *every* request-scoped instance attached to the shared session — including the in-flight ``workflow.steps`` collection. The next access in the same ``populate_module_and_state`` re-fetched a fresh ``WorkflowStep`` list from the DB, with ``.module`` unset on the new instances, so ``compute_runtime_state``'s ``assert step.module`` raised ``AttributeError: 'WorkflowStep' object has no attribute 'module'``. Every workflow-invocation test under ``use_lazy_toolbox=true`` 500'd. Fix: read methods on ``DatabaseToolSourceStore`` (``get``, ``exists``, ``get_by_tool_id``, ``get_by_source_path``, ``count``, ``list_all``, ``load_index``) now open a private ``Session`` bound to the same engine and close it on exit. The shared scoped session — and its caller's transaction state — is untouched. The original lock-release intent (cold-start populator, queue-worker init) still holds because each private session's read transaction ends when the session closes. Writes (``store``, ``store_index``, ``delete``, ``update_index_entry``) still use ``_get_session()`` so they participate in the caller's transaction and commit in the right context (populator, queue worker, ``LazyToolBox.__init__``).