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

Offen
#1,805 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Python
Sterne
14
Forks
15
Ø Merge
3 T. 2 Std.
Gemergte PRs (30 T.)
35

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus DiamondLightSource/blueapi

Alle Issues in DiamondLightSource/blueapi

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.