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

オープン
#1,805 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
14
フォーク
15
平均マージ
3日 2時間
マージ済み PR(30日)
35

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DiamondLightSource/blueapi のほかの issue

DiamondLightSource/blueapi の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。