Graceful shutdown using grpc-go's ServeHTTP()

537 views
Skip to first unread message

Francis Chuang

unread,
Jan 9, 2017, 10:55:23 PM1/9/17
to grpc.io
grpc-go has a ServeHTTP() method which allows the grpc server to be a handler for a net/http server. In go 1.8, the net/http server will have a Shutdown() method to gracefully shutdown. If I use the ServeHTTP() method as a handler, does calling net/http server's Shutdown() method cleanly shuts down everything and replicate grpc-go server's GracefulShutdown() method?

If not, how do I achieve graceful shutdown correctly when using the ServeHTTP() method?
Message has been deleted

mmu...@google.com

unread,
Feb 1, 2017, 3:13:33 PM2/1/17
to grpc.io
Actually I take that back. You could use grpc server as a http.Handler and run create your own http2 server. In such a case when you call Shutdown() the grpc server's Stop() or GracefulStop() aren't called because the grpc server is acting only as a handler. Thus, the Shutdown function on the http2 server should do what it does.
Reply all
Reply to author
Forward
0 new messages