Skip to content

perf: sequential PubSub dispatch blocks all subscribers on slow client #3151

@csmith49

Description

@csmith49

Problem

When an event fires, PubSub.__call__ iterates all subscribers sequentially and awaits each one. If one WebSocket subscriber is slow (congested client), it delays event delivery to all other subscribers for that conversation.

Location: pub_sub.py:63–74

Evidence

Code review of pub_sub.py:63–74.

Severity: Medium

Impact of fix

Slow clients don't block other subscribers.

Suggested fixes

  • Use asyncio.gather for concurrent dispatch
  • Or give each subscriber its own asyncio queue with independent drain

Discovered during profiling investigation (code review), May 2026. openhands-agent-server v1.19.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingperformancePerformance issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions