Skip to content

Bokeh 3.10 breaks LocalCluster shutdown on a running event loop #9350

Description

@bdice

Minimal Complete Verifiable Example

With distributed==2026.7.1 and bokeh==3.10.0:

from distributed import Client

client = Client(processes=False)
client.close()

Observed behavior

Client.close() raises:

Traceback (most recent call last):
  File "distributed/scheduler.py", line 4513, in close
    self.stop_services()
  File "distributed/node.py", line 79, in stop_services
    application.stop()
  File "bokeh/server/tornado.py", line 761, in stop
    raise RuntimeError("Cannot synchronously wait on a running event loop; use 'await stop_async()'")
RuntimeError: Cannot synchronously wait on a running event loop; use 'await stop_async()'

The scheduler's asynchronous close() path invokes the synchronous Bokeh application stop() method. Bokeh 3.10 rejects that call when its event loop is running.

Expected behavior

Client.close() shuts down the local cluster without raising.

Environment and regression range

  • Python 3.14.7
  • distributed 2026.7.1
  • bokeh 3.10.0
  • tornado 6.5.8
  • Linux aarch64

The reproducer passes with Bokeh 3.9.2. It also passes with Bokeh 3.10.0 when the dashboard service is disabled:

client = Client(processes=False, dashboard_address=None)
client.close()

We also reproduced the failure in CI on Python 3.12 through 3.14, x86_64 and aarch64. In an eight-worker pytest run, each worker's module-scoped client fixture failed during teardown while all test bodies passed:

https://github.com/NVIDIA/cudf/actions/runs/32277617246/job/96196009417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions