Skip to content

Conversation

andygrunwald
Copy link
Contributor

In ClientLogging (or better: in the roundTripper), if the result of the next roundTripper is nil, addRateLimitInformationToLog will throw a nil panic.

panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x102840ad4]

I added a test to replicate the behaviour.

Here is a full stack trace:

goroutine 69 [running]:
github.com/palantir/go-githubapp/githubapp.addRateLimitInformationToLog(0xc00026aecb, 0xc00029c1c0, 0x0)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/middleware_logging.go:215 +0x6c
github.com/palantir/go-githubapp/githubapp.ClientLogging.func1.1(0xc000276500)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/middleware_logging.go:95 +0x546
github.com/palantir/go-githubapp/githubapp.roundTripperFunc.RoundTrip(0xc00026c360, 0xc000276500)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/middleware.go:121 +0x34
github.com/palantir/go-githubapp/githubapp.ClientMetrics.func1.1(0xc000276500)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/middleware.go:64 +0x124
github.com/palantir/go-githubapp/githubapp.roundTripperFunc.RoundTrip(0xc00026c3c0, 0xc000276500)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/middleware.go:121 +0x34
github.com/palantir/go-githubapp/githubapp.(*clientCreator).newClient.setInstallationID.func1.1(0xc0002763c0)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/client_creator.go:426 +0xa8
github.com/palantir/go-githubapp/githubapp.roundTripperFunc.RoundTrip(0xc00004c520, 0xc0002763c0)
	/go/pkg/mod/github.com/palantir/[email protected]/githubapp/middleware.go:121 +0x34
net/http.send(0xc000276280, {0x11f21c0, 0xc00004c520}, {0x8?, 0x8?, 0x17606e0?})
	/usr/local/go/src/net/http/client.go:259 +0x8cb
net/http.(*Client).send(0xc00026c420, 0xc000276280, {0x0?, 0x633e54?, 0x17606e0?})
	/usr/local/go/src/net/http/client.go:180 +0x14d
net/http.(*Client).do(0xc00026c420, 0xc000276280)
	/usr/local/go/src/net/http/client.go:728 +0x1339
net/http.(*Client).Do(...)
	/usr/local/go/src/net/http/client.go:587
github.com/google/go-github/v74/github.(*Client).bareDo(0xc000550008, {0x11f7a78, 0x1782240}, 0xc00026c420, 0xc000276140)
	/go/pkg/mod/github.com/google/go-github/[email protected]/github/github.go:881 +0x4a8
github.com/google/go-github/v74/github.(*Client).BareDo(...)
	/go/pkg/mod/github.com/google/go-github/[email protected]/github/github.go:968
github.com/google/go-github/v74/github.(*Client).Do(0xc000550008, {0x11f7a78, 0x1782240}, 0xc000276140, {0xf2ee60, 0xc0004b0108})
	/go/pkg/mod/github.com/google/go-github/[email protected]/github/github.go:1036 +0xae
github.com/google/go-github/v74/github.(*PullRequestsService).List(0xc000550338, {0x11f7a78, 0x1782240}, {0xc00049a5b5, 0xb}, {0xc00049a5f7, 0x9}, 0xc000188c60)
	/go/pkg/mod/github.com/google/go-github/[email protected]/github/pulls.go:164 +0x23e
github.com/sourcectl/worker/consumer.(*GithubRepositoryPullRequestsConsumer).Start(0xc0000b35f0)
	/build/consumer/consumer_github_repository_pullrequests.go:177 +0x133d
github.com/sourcectl/worker/cmd.cmdGithubWorker.func4()
	/build/cmd/github_worker.go:177 +0x43
created by github.com/sourcectl/worker/cmd.cmdGithubWorker in goroutine 1
	/build/cmd/github_worker.go:176 +0x1aa5
	```

panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x102840ad4]
@changelog-app
Copy link

changelog-app bot commented Aug 21, 2025

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Fix potential panic when logging rate limit information

Check the box to generate changelog(s)

  • Generate changelog entry

@changelog-app
Copy link

changelog-app bot commented Aug 27, 2025

Successfully generated changelog entry!

What happened?

Your changelog entries have been stored in the database as part of our migration to ChangelogV3.

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.

Copy link
Contributor

@bluekeyes bluekeyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bluekeyes bluekeyes merged commit 9c64a7c into palantir:develop Aug 27, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants