Should fix:
```
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/galaxy/util/compression_utils.py", line 114, in extract
common_prefix_dir = self.common_prefix_dir
File "/usr/local/lib/python3.7/site-packages/galaxy/util/compression_utils.py", line 103, in common_prefix_dir
if len(common_prefix) >= 1 and not common_prefix.endswith(os.sep) and self.isdir(self.getmember(common_prefix)) \
File "/usr/local/lib/python3.7/site-packages/galaxy/util/compression_utils.py", line 186, in isdir
return getattr(self, 'isdir_%s' % self.type)(member)
File "/usr/local/lib/python3.7/site-packages/galaxy/util/compression_utils.py", line 189, in isdir_tar
return member.isdir()
AttributeError: 'NoneType' object has no attribute 'isdir'
```
seen on usegalaxy.eu with https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE176031&format=file
and invalidate `_output_hdas_and_paths` when current session is not the
same session that was used to populate `_output_hdas_and_paths`.
The Job instance may originate from a session that is associated to
another thread, and when that thread closes the session the instance
(along with other instances retrieved through loading relationships)
becomes detached.
I am not sure at all if this will fix
```
DetachedInstanceError: Instance <HistoryDatasetAssociation at 0x7fe68bbf14f0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)
File "galaxy/jobs/runners/__init__.py", line 291, in prepare_job
job_wrapper.prepare()
File "galaxy/jobs/__init__.py", line 1248, in prepare
tool_evaluator.set_compute_environment(compute_environment, get_special=get_special)
File "galaxy/tools/evaluation.py", line 162, in set_compute_environment
self.param_dict = self.build_param_dict(
File "galaxy/tools/evaluation.py", line 204, in build_param_dict
self.__populate_output_dataset_wrappers(param_dict, output_datasets, job_working_directory)
File "galaxy/tools/evaluation.py", line 447, in __populate_output_dataset_wrappers
param_dict[name] = DatasetFilenameWrapper(
File "galaxy/tools/wrappers.py", line 403, in __init__
path_rewrite = compute_environment and compute_environment.output_path_rewrite(dataset_instance)
File "galaxy/job_execution/compute_environment.py", line 132, in output_path_rewrite
return str(self.job_io.get_output_path(dataset))
File "galaxy/job_execution/setup.py", line 226, in get_output_path
if hda.id == dataset.id:
File "sqlalchemy/orm/attributes.py", line 487, in __get__
return self.impl.get(state, dict_)
File "sqlalchemy/orm/attributes.py", line 959, in get
value = self._fire_loader_callables(state, key, passive)
File "sqlalchemy/orm/attributes.py", line 990, in _fire_loader_callables
return state._load_expired(state, passive)
File "sqlalchemy/orm/state.py", line 712, in _load_expired
self.manager.expired_attribute_loader(self, toload, passive)
File "sqlalchemy/orm/loading.py", line 1369, in load_scalar_attributes
raise orm_exc.DetachedInstanceError(
```
but it seems to make some sense. JobIO crosses thread boundaries as part
of the job wrapper getting put into threading queues.
Ideally we'd make sure that no ORM instance crosses the thread boundary
(or we systematically re-associated with a session).
I also tried flagging these patterns automatically using something like:
```
@event.listens_for(session, "persistent_to_detached")
def on_detach(sess, instance):
if not getattr(instance, "allow_detatch", False):
raise Exception(f"{instance} detached. This ain't good for how we do things ?")
```
but it seems tricky to figure out when this is fine and when it is not.
Fixes https://github.com/galaxyproject/galaxy/issues/16987,
though there's probably something to be done for loc files
being loaded from tools. At the minimum this is a versioning
issue, if a new version of featureCounts comes with a new
built-in reference then an old version shouldn't use it,
and vice-versa. Seems like a hard problem to solve.
Fix the following traceback:
```
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: uvicorn.access INFO 2023-06-30 10:28:03,573 [pN:main.1,p:3528860,tN:MainThread] 193.156.42.8:0 - "HEAD /root/login HTTP/1.0" 500
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: Exception in supplement:
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: Traceback (most recent call last):
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/server/lib/galaxy/web/framework/middleware/error.py", line 165, in __call__
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: app_iter = self.application(environ, sr_checker)
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/venv/lib64/python3.11/site-packages/paste/recursive.py", line 85, in __call__
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: return self.application(environ, start_response)
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/venv/lib64/python3.11/site-packages/paste/httpexceptions.py", line 640, in __call__
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: return self.application(environ, start_response)
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/server/lib/galaxy/web/framework/base.py", line 167, in __call__
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: return self.handle_request(environ, start_response)
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/server/lib/galaxy/web/framework/base.py", line 221, in handle_request
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: rc.environ = environ
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: ^^^^^^^^^^
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/venv/lib64/python3.11/site-packages/routes/__init__.py", line 23, in __setattr__
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: self.load_wsgi_environ(value)
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: File "/cluster/galaxy-test/srv/galaxy/venv/lib64/python3.11/site-packages/routes/__init__.py", line 73, in load_wsgi_environ
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: self.__shared_state.host += ':' + environ['SERVER_PORT']
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Jun 30 10:28:03 galaxy01-test.educloud.no galaxyctl[3528286]: TypeError: can only concatenate str (not "int") to str
```
Reported by @vazovn : https://matrix.to/#/!rfLDbcWEWZapZrujix:gitter.im/$McOyd5Kmp-w-Z-bYbRUV42K30YhVvwRJtrCaxru-yf4?via=gitter.im&via=matrix.org
Added a `fixed_delegated_path` variable to the `ConfigSerializer` that
lets us reroute users to home if we have a Galaxy set up with:
```
config.enable_oidc
and len(config.oidc) == 1
and len(auth_manager.authenticators) == 0
```
as in; we only have 1 external auth and no local authenticator,
hence, we don't want users to be disconnecting the external
provider.