Skip to content

[BUG] UVicorn generates error 404 session id not found when starting multiple workers #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kaka1nices opened this issue Apr 13, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@kaka1nices
Copy link

kaka1nices commented Apr 13, 2025

Describe the bug
When using uvicorn to start multiple workers, the MCP server will report an error 404 session id Not Found due to session id issues

To Reproduce

uvicorn.run(app='server:app', host="0.0.0.0", port=8000,workers=2)

Error log

INFO:     127.0.0.1:63670 - "POST /mcp/messages/?session_id=5576a7215caf42a38ba8d7c996d07f17 HTTP/1.1" 202 Accepted
INFO:     127.0.0.1:63769 - "GET /mcp HTTP/1.1" 200 OK
INFO:     127.0.0.1:63670 - "POST /mcp/messages/?session_id=495548f6adc54c618f8619d1ae07e51e HTTP/1.1" 404 Not Found

System Info
Python 3.12.5

@kaka1nices kaka1nices added the bug Something isn't working label Apr 13, 2025
@kaka1nices kaka1nices changed the title [BUG] [BUG] UVicorn generates error 404 session id not found when starting multiple workers Apr 13, 2025
@tonderflash
Copy link

I'll be working on this issue

@surki
Copy link

surki commented Apr 14, 2025

thanks @tonderflash
We are also looking for this, as we run multiple pods and multiple workers, spanning multiple machines.

@tonderflash
Copy link

tonderflash commented Apr 15, 2025

@surki I'm considering implementing a shared storage mechanism for SSE sessions that would work with multiple workers/pods to solve this issue. Do you have any specific preferences or restrictions regarding storage solutions (Redis, databases, etc.) that I should take into account for the use case?

@surki
Copy link

surki commented Apr 16, 2025

@tonderflash Perhaps we should have some kind of common interface for session management. Then we could have few implementations to start with, redis or so (we are looking at leveraging redis since it is already present in our infra).

We should also think about purging stale entries, what happens if the target instance is down etc

@maiyad-sia
Copy link

Any updates on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants