fix: handle net.Listen error in gRPC ExternalScaler goroutine (#323)#324
Conversation
The error returned by net.Listen was silently discarded with '_'. When Listen fails (port conflict, permission denied), the listener is nil and grpcServer.Serve(nil) panics with a nil-pointer dereference, crashing the controller-manager with no diagnostic output. Now the error is checked and logged with the bind address before exiting. Fixes openkruise#323
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @abhaygoudannavar! It looks like this is your first PR to openkruise/kruise-game 🎉 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #324 +/- ##
=======================================
Coverage 40.53% 40.53%
=======================================
Files 112 112
Lines 12547 12547
=======================================
Hits 5086 5086
Misses 7051 7051
Partials 410 410
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What this PR does
Fixes a nil-pointer panic in the gRPC ExternalScaler server goroutine caused by a discarded
net.Listenerror.Problem
In
main.go, the error returned bynet.Listenwas silently discarded:When Listen fails (e.g. port conflict, permission denied), lis is nil. The subsequent call to grpcServer.Serve(nil) dereferences the nil listener and panics, crashing the controller-manager with no diagnostic log output.
Fix
Fixes #323