-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix nil dereference panic after 8563c7a #1072
Fix nil dereference panic after 8563c7a #1072
Conversation
changelog detected ✅ |
Codecov Report
@@ Coverage Diff @@
## master #1072 +/- ##
==========================================
+ Coverage 49.94% 50.04% +0.09%
==========================================
Files 115 116 +1
Lines 10991 11047 +56
==========================================
+ Hits 5490 5528 +38
- Misses 4338 4350 +12
- Partials 1163 1169 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
841b32c
to
0f4e7f2
Compare
are you able to provide a reproduction case where this would first fail that we can put into a regression test? |
I'm afraid not, it only happens on production environment which would be a bit complicated. Anyways you can emulate any network error that will return |
the testing i've tried with this using a variety of 4xx and 5xx being returned but none have actually surfaced the panic. in all cases, |
there is no harm adding the additional safety here however, i'm curious to find out where this is popping up to handle it specifically instead of as a generic error. |
This functionality has been released in v0.49.0. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
@jacobbednarz I think the fix is appropriate and it's a good practice to be defensive, especially when you interact with remote APIs. Having that said, after upgrading to 0.49 I realized it's likely related to context timeouts. Now, in the same environment, I'm getting: "operation aborted during backoff: context deadline exceeded", which may explain why you were getting resp with live API interaction but likely not hitting (or setting) context timeout. |
i don't think anyone was disagreeing the change was a good idea. my reservation was with adding code and hoping it helped instead of having a solid example of it addressing the problem. the context deadline is a good lead; thanks. have you got an example to share that is demonstrating the issue? if not, i'll have to have a play and see if i can pull something together for it. |
I created #1080 with a potential improvement. Basically, resp is "nil" on context timeout in go http client. The way to reproduce is to impose an artificially short timeout to force the code going through this path (example in the pull request), crashes with 0.48 and generates a bit ambiguous error in 0.49, so exiting earlier will likely cover well for such issue and follow the spirit of less processing /. less bugs approach. |
Description
Fixes nil panic regression introduced by 8563c7a, if
respErr != nil
then body is most likelynil
.Has your change been tested?
N/A
Types of changes
What sort of change does your code introduce/modify?
Checklist: