Skip to content

Major performance regression when nonexistent tail_consumers are set in wrangler.toml #11712

@danielcompton

Description

@danielcompton

What versions & operating system are you using?

  System:
    OS: macOS 26.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 417.20 MB / 64.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 23.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 9.12.1 - /opt/homebrew/bin/pnpm
    bun: 1.2.22 - /Users/danielcompton/.bun/bin/bun
    Deno: 1.46.3 - /opt/homebrew/bin/deno
  npmPackages:
    wrangler: ^4.32.0 => 4.56.0

Please provide a link to a minimal reproduction

https://github.com/danielcompton/cf-tail-consumer-repro

Describe the Bug

While upgrading wrangler, I discovered a major performance regression I narrowed down to 4.32.0. After handling hundreds of websocket messages from mouse cursor position updates, wrangler slows to a crawl. I've attached a minimal reproduction.

Reproduce

To reproduce, open the sample in two browsers and wiggle your mouse. After ~500 events, the mouse shown in the other screen will start slowing down, becoming choppy. This seems to be because wrangler is not able to process the events quickly enough.

cf.mov

After a long time debugging this, I was able to narrow it down to this line in our wrangler.toml:

tail_consumers = [
    { service = "missing-consumer-xyz" }
]

Removing that line fixes the issue entirely in 4.32.0, as does downgrading to 4.31.0.

There was a note in the logs about sending tail events to workers that are not connected, but this wasn't displayed as an error.

Where this came from

From bisecting between 4.31.0 and 4.32.0, the issue appears to have been introduced in d304055, #10245.

cc @edmundhung

Please provide any relevant error logs

Note there are no errors shown in the logs here.

$ npm run dev-bad

> multiplayer-js@1.0.0 dev-bad
> npx wrangler@4.32.0 dev


 ⛅️ wrangler 4.32.0 (update available 4.56.0)
─────────────────────────────────────────────
Your Worker has access to the following bindings:
Binding                                         Resource            Mode
env.MULTIPLAYER_OBJECT (multiplayerObject)      Durable Object      local

Your Worker is sending Tail events to the following Workers:
- missing-consumer-xyz [not connected]

Service bindings, Durable Object bindings, and Tail consumers connect to other wrangler or vite dev processes running locally, with their connection status indicated by [connected] or [not connected]. For more details, refer to https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development

╭──────────────────────────────────────────────────────────────────────╮
│  [b] open a browser [d] open devtools [c] clear console [x] to exit  │
╰──────────────────────────────────────────────────────────────────────╯
⎔ Starting local server...
[wrangler:info] Ready on http://localhost:8787
[wrangler:info] GET /api/multiplayer 101 Switching Protocols (7ms)
[wrangler:info] GET /api/multiplayer 101 Switching Protocols (4ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions