Messages leak to other users #113

Closed
opened 2026-02-15 19:16:04 -05:00 by yindo · 2 comments
Owner

Originally created by @Tetr4 on GitHub (Jan 13, 2025).

When two users make a request for the streaming endpoint at the same time, user A's stream will contain chat engine events from user B's stream. This leaks user B's message to user A, if the events contain the message as a context query:

{
    "type": "events",
    "data": {
        "title": "Retrieving context for query: 'Show me articles related to machine learning.\n'"
    }
}

A workaround is to remove the event_handler from VercelStreamResponse. Ideally these chat engine events should only be emitted to the request that triggered them, but i am not sure if that is possible.

Originally created by @Tetr4 on GitHub (Jan 13, 2025). When two users make a request for the streaming endpoint at the same time, user A's stream will contain chat engine events from user B's stream. This leaks user B's message to user A, if the events contain the message as a context query: ```json { "type": "events", "data": { "title": "Retrieving context for query: 'Show me articles related to machine learning.\n'" } } ``` A workaround is to remove the `event_handler` from `VercelStreamResponse`. Ideally these chat engine events should only be emitted to the request that triggered them, but i am not sure if that is possible.
yindo closed this issue 2026-02-15 19:16:04 -05:00
Author
Owner

@leehuwuj commented on GitHub (Jan 15, 2025):

Hi @Tetr4 , How did you run the API? Theoretically, if you start the FastAPI app with Uvicorn, each user request is handled by a single worker, so there should be no data race.

@leehuwuj commented on GitHub (Jan 15, 2025): Hi @Tetr4 , How did you run the API? Theoretically, if you start the FastAPI app with Uvicorn, each user request is handled by a single worker, so there should be no data race.
Author
Owner

@Tetr4 commented on GitHub (Jan 18, 2025):

@leehuwuj Ah sorry my bad, I was still testing with a project that was generated from an old template 🤦 This was fixed by the event handler changes in #260 and I can confirm it does not happen in new projects. I will close this issue 🙂

@Tetr4 commented on GitHub (Jan 18, 2025): @leehuwuj Ah sorry my bad, I was still testing with a project that was generated from an old template 🤦 This was fixed by the event handler changes in #260 and I can confirm it does not happen in new projects. I will close this issue 🙂
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/create-llama#113