Open andrejgou opened 1 year ago
This PR has been marked stale because there has been no activity within the last 28 days. To keep this PR active, remove the stale
label.
This PR has been marked stale because there has been no activity within the last 28 days. To keep this PR active, remove the stale
label.
Errors when dumping the response are ignored so an empty value is cached, which causes deserialization of the response to fail with an error, which is also ignored, which causes a nil pointer panic.
Summary
Okta HTTP requests were occasionally failing with nil pointer panics. The stack trace showed the panic originating from this line: https://github.com/okta/okta-sdk-golang/blob/758b8c38315d262ab5aedb4694655d48ebb68384/okta/requestExecutor.go#L668 called from this line: https://github.com/okta/okta-sdk-golang/blob/1d378b9b66749810bad94d50019e7693d2aaf039/okta/requestExecutor.go#L470 The only way the HTTP response can be nil is if deserialization fails, which can only fail if the cached value is invalid, which can only happen if serialization of the HTTP response fails when setting the value in the cache: https://github.com/okta/okta-sdk-golang/blob/758b8c38315d262ab5aedb4694655d48ebb68384/okta/cache/goCache.go#L59
The easiest fix I could think of was to just skip setting the cache for values that failed serialization. The only potential impact is additional cache misses, but only for invalid values that aren't usable anyway.
Fixes N/A
Type of PR
Test Information
Go Version: Os Version: OpenAPI Spec Version:
Signoff
make fmt
on my code