Recover panics in gRPC handlers

Summary

Add panic recovery interceptors for gRPC handlers to prevent server goroutine crashes. When a panic occurs, the interceptor logs the stack trace and returns codes.Internal to the caller instead of crashing.

Changes

  • Add interceptor.go with unary and stream panic recovery interceptors
  • Wire up interceptors via ErrorOnPanic() function which returns grpc.ServerOption values
  • For both unary and stream handlers: panic is recovered, logged with stack trace, and codes.Internal is returned
  • Add GRPCStatus() method to errBadJobID to return codes.NotFound instead of generic error
  • Comprehensive test coverage for all panic recovery scenarios

References

Relates to #430 (closed)

Edited by Cameron Swords

Merge request reports

Loading