Skip to content
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

logging: panic: runtime error: invalid memory address or nil pointer dereference #8408

Closed
ukai opened this issue Aug 11, 2023 · 4 comments · Fixed by #8415
Closed

logging: panic: runtime error: invalid memory address or nil pointer dereference #8408

ukai opened this issue Aug 11, 2023 · 4 comments · Fixed by #8415
Assignees
Labels
api: logging Issues related to the Cloud Logging API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ukai
Copy link

ukai commented Aug 11, 2023

Client

e.g. Cloud Logging

Environment

e.g. Alpine Docker on GKE

Go Environment

$ go version
$ go env

Code

https://chromium-review.googlesource.com/c/infra/infra/+/4769930/2/go/src/infra/go.mod

Expected behavior

Don't panic.

Actual behavior

https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8773108843220167633/+/u/Build_all_without_remote_cache/stdout

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xab79b8]

goroutine 177 [running]:
cloud.google.com/go/logging.(*loggerRetryer).Retry(0xc03d12d130, {0x1020d20, 0xc09477e630})
	cloud.google.com/go/logging@v1.8.0/logging.go:275 +0x78
github.com/googleapis/gax-go/v2.invoke({0x102b460, 0xc0992178f0}, 0xc0404e5e90, {0xc03d12d140, {0x0, 0x0, 0x0}, {0x0, 0x0}, 0xdf8475800}, ...)
	github.com/googleapis/gax-go/v2@v2.12.0/invoke.go:108 +0x21d
github.com/googleapis/gax-go/v2.Invoke({0x102b460, 0xc0992178f0}, 0xc0404e5e70?, {0xc0847b7900, 0x3, 0xc099217830?})
	github.com/googleapis/gax-go/v2@v2.12.0/invoke.go:50 +0xdd
cloud.google.com/go/logging/apiv2.(*gRPCClient).WriteLogEntries(0xc000050540, {0x102b428?, 0xc099217830?}, 0xc055371420, {0xc03d12d160, 0x1, 0xc0404e5f10?})
	cloud.google.com/go/logging@v1.8.0/apiv2/logging_client.go:360 +0x192
cloud.google.com/go/logging/apiv2.(*Client).WriteLogEntries(...)
	cloud.google.com/go/logging@v1.8.0/apiv2/logging_client.go:225
cloud.google.com/go/logging.(*Logger).writeLogEntries(0xc000720c00, {0xc03221b800, 0x3e8, 0x500})
	cloud.google.com/go/logging@v1.8.0/logging.go:738 +0x23b
cloud.google.com/go/logging.(*Client).Logger.func2({0xd15ec0?, 0xc07f8d21f8?})
	cloud.google.com/go/logging@v1.8.0/logging.go:298 +0x45
google.golang.org/api/support/bundler.(*Bundler).handle(0xc0000ea420, 0x0?)
	google.golang.org/api@v0.136.0/support/bundler/bundler.go:324 +0x4a
created by google.golang.org/api/support/bundler.(*Bundler).enqueueCurBundle
	google.golang.org/api@v0.136.0/support/bundler/bundler.go:179 +0x14d

Additional context

Started after upgrading to v1.8.0

@ukai ukai added the triage me I really want to be triaged. label Aug 11, 2023
@product-auto-label product-auto-label bot added the api: logging Issues related to the Cloud Logging API. label Aug 11, 2023
@noi
Copy link

noi commented Aug 14, 2023

I have encountered the same problem. I think the cause is that defaultRetryer is always nil.

  • func (r *loggerRetryer) Retry(err error) (pause time.Duration, shouldRetry bool) {
    s, ok := status.FromError(err)
    if !ok {
    return r.defaultRetryer.Retry(err)
    }
    if s.Code() == codes.Internal && strings.Contains(s.Message(), "string field contains invalid UTF-8") {
    return 0, false
    }
    return r.defaultRetryer.Retry(err)
    }
  • r := &loggerRetryer{}

@codyoss codyoss added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed triage me I really want to be triaged. labels Aug 14, 2023
@noahdietz
Copy link
Contributor

noahdietz commented Aug 14, 2023

I've got what I think is the proper fix in #8415 but will need @daniel-sanche or @tomo241 to verify/review.

@noahdietz
Copy link
Contributor

Reopening until I release the fix.

@noahdietz
Copy link
Contributor

Please give this new patch release a shot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants