Graceful shutdown when using custom http.Server #598
Unanswered
duaraghav8
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm currently trying to add SSE session management in my MCP gateway
When I create a new
SSEServer
for the gateway, I don't use itsStart()
method to run the server.Instead, I use my custom
http.Server
object because I also need to add lots of other http routes to my server for other purposes.But when I run the
Shutdown()
method on my SSEServer, it doesn't seem to call the Unregister Session callback from the hooks.Because of this, I'm unable to perform a graceful shutdown because I need to run cleanups inside the callback.
Minimal code to reproduce this:
curl localhost:9000/sse
. Keep it open.Note that if, instead of using my custom http.Server, I were simply using
sse.Start()
to run the server, then the callback will be called and graceful shutdown is possible.So I don't understand what is happening differently due to my custom http.Server.
Can someone please suggest what am I doing wrong and how to do this correctly?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions