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

Panic when running command on closed PR #3477

Closed
pseudomorph opened this issue Jun 2, 2023 · 4 comments
Closed

Panic when running command on closed PR #3477

pseudomorph opened this issue Jun 2, 2023 · 4 comments
Labels
bug Something isn't working regression Bug introduced in a new version

Comments

@pseudomorph
Copy link
Contributor

pseudomorph commented Jun 2, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Atlantis panics when running operation on closed PR.

Reproduction Steps

Run any command, other than atlantis help on a closed PR.

Logs

Logs
{"level":"error","ts":"2023-06-02T18:12:22.501Z","caller":"events/command_runner.go:429","msg":"PANIC: runtime error: invalid memory address or nil pointer dereference\nruntime/panic.go:260 (0x44e11c)\nruntime/signal_unix.go:837 (0x44e0ec)\ngit.luolix.top/runatlantis/atlantis/server/events/command_runner.go:410 (0xf7094a)\ngit.luolix.top/runatlantis/atlantis/server/events/command_runner.go:286 (0xf6e44f)\nruntime/asm_amd64.s:1598 (0x46b2e0)\n","json":{"repo":"some-repo","pull":"85"},"stacktrace":"github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).logPanics\n\tgit.luolix.top/runatlantis/atlantis/server/events/command_runner.go:429\nruntime.gopanic\n\truntime/panic.go:890\nruntime.panicmem\n\truntime/panic.go:260\nruntime.sigpanic\n\truntime/signal_unix.go:837\ngit.luolix.top/runatlantis/atlantis/server/events.(*DefaultCommandRunner).validateCtxAndComment\n\tgit.luolix.top/runatlantis/atlantis/server/events/command_runner.go:410\ngit.luolix.top/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgit.luolix.top/runatlantis/atlantis/server/events/command_runner.go:286"}
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xf70e83]

goroutine 2517 [running]:
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).logPanics(0xc0002249c0, {{0xc000837580, 0x1b}, {0xc000837580, 0x9}, {0xc00083758a, 0x11}, {0xc00070e850, 0x6e}, {0xc00003de00, ...}, ...}, ...)
	github.com/runatlantis/atlantis/server/events/command_runner.go:430 +0x203
panic({0x1173100, 0x1dae110})
	runtime/panic.go:890 +0x263
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).validateCtxAndComment(0xc0002249c0, 0xc000874540, 0x28?)
	github.com/runatlantis/atlantis/server/events/command_runner.go:410 +0x36a
github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand(0xc0002249c0, {{0xc000837580, 0x1b}, {0xc000837580, 0x9}, {0xc00083758a, 0x11}, {0xc00070e850, 0x6e}, {0xc00003de00, ...}, ...}, ...)
	github.com/runatlantis/atlantis/server/events/command_runner.go:286 +0xbb0
created by github.com/runatlantis/atlantis/server/controllers/events.(*VCSEventsController).handleCommentEvent
	github.com/runatlantis/atlantis/server/controllers/events/events_controller.go:593 +0x630

Environment details

  • Atlantis version: custom based off master
  • Deployment method: ecs
  • If not running the latest Atlantis version have you tried to reproduce this issue on the latest version:
  • Atlantis flags:

Atlantis server-side config file:

atlantis-url: http://some.url
data-dir: /app/.atlantis/
allow-draft-prs: true
allow-fork-prs: true
checkout-strategy: merge
checkout-depth: 1000
automerge: true
gh-user: some-user
log-level: debug
port: 3000
repo-whitelist: some-repo
hide-prev-plan-comments: true
markdown-template-overrides-dir: ~/.markdown_templates
enable-diff-markdown-format: true
parallel-plan: true

Additional Context

@pseudomorph pseudomorph added the bug Something isn't working label Jun 2, 2023
@nitrocode
Copy link
Member

Could you check previous versions to see if this is a regression?

Do you have the bandwidth to look into this issue?

What is the benefit of running the Atlantis commands on a closed pr? I'm assuming it's not merged but closed and still holding on to locks so maybe you're trying to run atlantis unlock?

@pseudomorph
Copy link
Contributor Author

This isn't so much a feature that needs to be used, but sometimes out developers accidentally click "close with comment" when submitting a command to Atlantis, or run a command on a closed PR.

I'm reporting this, since it seems that this used to be handled sanely without panic/crash.

I'll test this on the latest release to verify it's not something weird with my branch build.

@nitrocode
Copy link
Member

I'm reporting this, since it seems that this used to be handled sanely without panic/crash.

Any idea what version did not have this last ?

@nitrocode nitrocode added the regression Bug introduced in a new version label Jun 5, 2023
@pseudomorph
Copy link
Contributor Author

I tried with some different release versions and it didn't happen. I was running an image built from #3379. I rebuilt and the issue has disappeared.

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Bug introduced in a new version
Projects
None yet
Development

No branches or pull requests

2 participants