I recently posted a query [1] to the grpc mailing list to clarify a
behavior in the Go gRPC server - a panic() in a request handler
function would terminate the server process. Now, I know that's not
the case in the net/http server implementation - a demo here [2].

However, the interesting thing that I read in one of the replies is
that this isn't considered something that is desirable in the net/http
package either. but is a historical choice that we wish could have
been different. I was wondering if someone here would know about that
and why it may not be desirable to have automatic recovery in the http
server implementation because even with the automatic recovery in
place:

1. The application author/operator user will get to know when a panic
has occurred unless the
ErrAbortHandler value is used to panic.
2. The application author can still implement a middleware and not let
the stdlib's panic handling mechanism get
invoked at all to run any custom cleanup for example.


[1] https://groups.google.com/g/grpc-io/c/J8T43gWMwnI
[2] https://gist.github.com/amitsaha/ec7ce96e47bbfca0e7a52d5bff53485b

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CANODV3nGDhPGzAPNyr6KZAuD6uU6jr%3DOYasCjZ%3DJeJbYRiir3A%40mail.gmail.com.

Reply via email to