Skip to content

event_dispatcher has race condition #27

Description

@gladish

When a client connects, an event_dispatcher is created for the session. At that point, there's one thread created to send heartbeats by producing an outgoing message in the event_dispatcher. If the client submits a tool call request, the response for that request is also sent back by producing an outgoing message in the event_dispatcher. If those two happen before the thread waiting to consume the outgoing message (wait_event), then one of them gets overwritten.

I think the correct fix is to use a std::queue<> in event_dispatcher. You can use std::move and be as efficient as you are now and remove any possibility of losing messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions