Repository navigation
Closed
Labels
Description
When the detectors parameter is malformed, a POST to /api/v1/tasks can cause Blueapi to hang. In the system tests (just), the request ( detectors is a string rather than a list):
curl -X 'POST' \
'http://localhost:4180/api/v1/tasks' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"name": "count",
"params": {
"detectors": "stage.x"
},
"instrument_session": "cm12345-1"
}'Will cause the server to output the stack trace:
2026-10-16 16:33:50,336 INFO blueapi.worker.task_worker Awaiting task
2026-10-16 16:34:40,408 INFO blueapi.service.main 127.0.0.1:0 POST /api/v1/tasks
2026-10-16 16:34:40,409 INFO blueapi.service.authorization Checking permissions to run task
Exception in thread Thread-3 (_handle_results):
Traceback (most recent call last):
File "/home/danielfernandes/.local/share/uv/python/cpython-3.14.0-linux-x86_64-gnu/lib/python3.14/threading.py", line 1081, in _bootstrap_inner
self._context.run(self.run)
~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/home/danielfernandes/.local/share/uv/python/cpython-3.14.0-linux-x86_64-gnu/lib/python3.14/threading.py", line 1023, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/danielfernandes/.local/share/uv/python/cpython-3.14.0-linux-x86_64-gnu/lib/python3.14/multiprocessing/pool.py", line 579, in _handle_results
task = get()
File "/home/danielfernandes/.local/share/uv/python/cpython-3.14.0-linux-x86_64-gnu/lib/python3.14/multiprocessing/connection.py", line 257, in recv
return _ForkingPickler.loads(buf.getbuffer())
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: "Invalid error type: 'sequence_str'"Then both the server and client will hang.
Acceptance Criteria
- A task request with
detectorsas a string raises a neat validation error, and does not cause Blueapi to hang
Activity
abbiemery commentedon Oct 20, 2026
I have just encountered this when reviewing #1662 . I am not sure what change this occurred in but it didn't used to do this. We need to get this handling validation errors correctly again ASAP.
oliwenmandiamond commentedon Oct 20, 2026
I encountered this when updating system tests for the *args and **kwargs change and reported to Dan. Thanks for prioritising this issue
tpoliaw commentedon Oct 20, 2026
Problem first appeared after #1579 where we updated dodal from 2.2.2 to 2.5.1 which includes DiamondLightSource/dodal#1734.
Previously
countexpected alist[str]whereas it now expects aSequence[str]. This raised a different validation error and some of pydantic's ValidationError types are not (un)picklable so when the errors are passed back across the subprocess boundary we get the internal error where we didn't before.I have opened an issue with pydantic but given any fix for that will be a while and we don't use the validation errors directly anyway, we should probably look at converting the errors into something picklable in the subprocess and raising that instead.
fix: Convert ValidationErrors into something picklable (DiamondLightS…