BlueAPI client hangs after task completes on server (pl.rd, pl.move)

Ouverte
#1,805 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
python

Piste de recherche

Start in BlueAPISession._live_plot_during_task in sm_bluesky/common/clients/blueapi_session.py around line 178, where the wrapper polls with time.sleep and then blocks on future.result(). Compare with the server-side event handling in blueapi.worker.task_worker, since the log shows the task finishing before the client waits. Done means pl.rd and pl.move return the result after a task finishes early or a Stomp reconnect occurs, with tests for both cases.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug

Plans complete successfully on the BlueAPI server, but the client never receives the result and blocks until Ctrl-C. Both cases hang in BlueAPISession._live_plot_during_task (blueapi_session.py:178) waiting on future.result().

  • pl.rd(dev.halbach.angle): server log shows Task ran successfully - returned: -180.0 within ~1 ms, client never returns.
  • pl.move({dev.energy_ud: 630}): move completes on the server, client logs Stomp connection lost, will attempt reconnection ... and never returns.
  • pl.set_absolute(dev.energy_ud, 638) returns fine.

Likely cause: the task-complete event is missed (fast tasks finishing before the listener is ready, or events lost during the Stomp reconnect), so the future is never resolved.

Environment: i10, i10_sm-bluesky venv, Python 3.12

Steps To Reproduce

  1. Start an I10 BlueAPI client session.
  2. Run pl.rd(dev.halbach.angle); it hangs.
  3. Run pl.move({dev.energy_ud: 630}); it hangs after Stomp connection lost.
  4. Compare the server log, which shows both tasks finished.

Acceptance Criteria

  • pl.rd and pl.move return their result on the client once the server task finishes.
  • A Stomp disconnect/reconnect during a task doesn't leave the client waiting forever (fall back to polling task status over REST, or add a timeout with a clear error).
  • Tests cover a task that finishes before the client starts listening, and a dropped connection mid-task.

Client Log

pl.rd(dev.halbach.angle)
WARNING:blueapi.config:OIDCConfig.well_known_url is deprecated, Please use OIDCConfig.issuer
WARNING:blueapi.config:OIDCConfig.well_known_url is deprecated, Please use OIDCConfig.issuer
WARNING:blueapi.config:OIDCConfig.well_known_url is deprecated, Please use OIDCConfig.issuer
WARNING:blueapi.config:OIDCConfig.well_known_url is deprecated, Please use OIDCConfig.issuer
^C---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
Cell In[15], line 1
----> 1 pl.rd(dev.halbach.angle)

File /dls_sw/i10/software/blueapi/i10_sm-bluesky/lib64/python3.12/site-packages/blueapi/client/plan_cache.py:85, in Plan.call(self, *args, **kwargs)
78 req = TaskRequest(
79 name=self.name,
80 args=list(args),
81 params=kwargs,
82 instrument_session=self._client.instrument_session,
83 )
84 try:
---> 85 match self._client.run_task(req):
86 case TaskStatus(result=TaskResult(result=res)):
87 return res

File /dls_sw/i10/software/blueapi/i10_sm-bluesky/lib64/python3.12/site-packages/sm_bluesky/common/clients/blueapi_session.py:178, in BlueAPISession._live_plot_during_task..wrapper(*args, **kwargs)
176 last_update = now
177 self._refresh_plots(update_data=should_update)
--> 178 time.sleep(0.18)
179 self._refresh_plots(update_data=True)
180 return future.result()

KeyboardInterrupt:

Server log

2026-11-21T12:40:06.524137978Z 2026-11-21 12:40:06,523 INFO blueapi.worker.task Asked to run plan rd with {} and metadata {'user': 'wvx67826', 'instrument_session': 'cm44153-5', 'blueapi_task_id': '3fb209c7-b01c-43d1-855b-27cb749e6ca8'} for all runs
2026-11-21T12:40:06.524219810Z 2026-11-21 12:40:06,524 INFO bluesky Executing plan <generator object rd at 0x7f5da919c280>
2026-11-21T12:40:06.524384930Z 2026-11-21 12:40:06,524 INFO bluesky.RE.state Change state on <bluesky.run_engine.RunEngine object at 0x7f5d52a392b0> from 'idle' -> 'running'
2026-11-21T12:40:06.525071020Z 2026-11-21 12:40:06,525 INFO blueapi.service.main 10.42.0.34:58298 PUT /worker/task 200
2026-11-21T12:40:06.525084302Z 2026-11-21 12:40:06,525 INFO bluesky.RE.state Change state on <bluesky.run_engine.RunEngine object at 0x7f5d52a392b0> from 'running' -> 'idle'
2026-11-21T12:40:06.525357629Z 2026-11-21 12:40:06,525 INFO bluesky Cleaned up from plan <generator object rd at 0x7f5da919c280>
2026-11-21T12:40:06.525496440Z 2026-11-21 12:40:06,525 INFO blueapi.worker.task_worker Task ran successfully - returned: -180.0
2026-11-21T12:40:06.525866676Z 2026-11-21 12:40:06,525 INFO blueapi.worker.task_worker Awaiting task

Langage dominant
Python
Étoiles
14
Forks
15
Merge moyen
3 j 2 h
PR mergées (30 j)
35

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de DiamondLightSource/blueapi

Toutes les issues de DiamondLightSource/blueapi

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.