esnet / esnet/janus

Unable to find container id

Open
#29 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

While redeploying CMS XCaches (docker behind the scenes), noticed the following failure:
```
2025-05-21 11:17:54,034 [app.py:828] [ERROR] Exception on /api/janus/controller/stop/121 [PUT]
Traceback (most recent call last):
File "/opt/janus/janus/api/controller.py", line 308, in put
return session_manager.stop_session(id)
File "/opt/janus/janus/api/session_manager.py", line 382, in stop_session
cid = s['container_id']
KeyError: 'container_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/usr/local/lib/python3.10/site-packages/flask_restx/api.py", line 402, in wrapper
resp = resource(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
File "/usr/local/lib/python3.10/site-packages/flask_restx/resource.py", line 41, in dispatch_request
resp = meth(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_httpauth.py", line 174, in decorated
return self.ensure_sync(f)(*args, **kwargs)
File "/opt/janus/janus/api/controller.py", line 314, in put
raise InternalServerError(f'Stopping session failed:FATAL:{type(e)}:{e}')
werkzeug.exceptions.InternalServerError: 500 Internal Server Error: Stopping session failed:FATAL::'container_id'
```
It was happening anytime I do create/delete on the Janus Web UI. It looks like the following change broke it (especially inside the session_manager.py lines 310 and 381): https://github.com/esnet/janus/commit/62e5ab5aa0e178e1497d53555668102f50e2f594#diff-4e55cea4f0ac47f60cf363e91f6d7f46fb7b174417cc829cff5e01e9e9b85764R343 . I edited Janus (for Xcaches) directly with the following change:
```
310,314c310
< cid = s.get("container_id")
< if not cid:
< log.warning(f"Skipping service with no cotnainer_id: {k} {s}")
< error = True
< continue
---
> cid = s["container_id"]
381,383c377
< cid = s.get('container_id')
< if not cid:
< log.warning(f"Skipping service with no container_id: {k} {s}")
---
> cid = s['container_id']
527a522
>
```
With the following change, I was able to proceed and launch XCache containers.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.