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

SIGSEV during git town propose #3539

Closed
FirelightFlagboy opened this issue May 18, 2024 · 3 comments · Fixed by #3606 or #3611
Closed

SIGSEV during git town propose #3539

FirelightFlagboy opened this issue May 18, 2024 · 3 comments · Fixed by #3606 or #3611
Labels

Comments

@FirelightFlagboy
Copy link

FirelightFlagboy commented May 18, 2024

Steps to reproduce

N/A

Command output

Handle unfinished command: continue

[parsec-v2-main-program] git merge --no-edit main
Already up to date.

[parsec-v2-main-program] git push -u origin parsec-v2-main-program
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 727 bytes | 727.00 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
remote: 
remote: Create a pull request for 'parsec-v2-main-program' on GitHub by visiting:
remote:      https://github.com/FirelightFlagboy/parsec-cloud-nix/pull/new/parsec-v2-main-program
remote: 
To github.com:FirelightFlagboy/parsec-cloud-nix.git
 * [new branch]      parsec-v2-main-program -> parsec-v2-main-program
branch 'parsec-v2-main-program' set up to track 'origin/parsec-v2-main-program'.

[parsec-v2-main-program] git stash pop
On branch parsec-v2-main-program
Your branch is up to date with 'origin/parsec-v2-main-program'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   packages/v3/native-build.nix

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (d0a2f5e5ef981c79574a76fe10bd18636d5cc08f)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6b0b60]

goroutine 1 [running]:
github.com/git-town/git-town/v14/src/vm/opcodes.(*CreateProposal).Run(0xc0002844f8, {{0x0, 0x0}, 0xc000420020, 0xc0001eb8c0, 0xc000382290, 0xc0003822a0, 0xc000149440, 0xc0003b2260})
        github.com/git-town/git-town/v14/src/vm/opcodes/create_proposal.go:23 +0x80
github.com/git-town/git-town/v14/src/vm/interpreter/full.Execute({0xc00020ec18, {0x0, 0x0}, 0xc000420020, 0x0, {{0xc000150734, 0x16}, {0xc000259180, 0x3, 0x4}}, ...})
        github.com/git-town/git-town/v14/src/vm/interpreter/full/execute.go:27 +0x2a3
github.com/git-town/git-town/v14/src/validate.continueRunstate(0xc00016ab40, {{0x0, 0x0}, {0xc000150734, 0x16}, {0x12a8860, 0x0, 0x0}, 0x0, {{0xc000150734, ...}, ...}, ...})
        github.com/git-town/git-town/v14/src/validate/handle_unfinished_state.go:100 +0x1f8
github.com/git-town/git-town/v14/src/validate.HandleUnfinishedState({{0x0, 0x0}, {0xc000150734, 0x16}, {0x12a8860, 0x0, 0x0}, 0x0, {{0xc000150734, 0x16}, ...}, ...})
        github.com/git-town/git-town/v14/src/validate/handle_unfinished_state.go:48 +0x4c8
github.com/git-town/git-town/v14/src/execute.LoadRepoSnapshot({0xc00020ec18, {0x12a8860, 0x0, 0x0}, 0x1, 0x1, 0xc0001eb9b0, {0x0, 0x0, 0x0, ...}, ...})
        github.com/git-town/git-town/v14/src/execute/load_repo_snapshot.go:23 +0x285
github.com/git-town/git-town/v14/src/cmd.determineProposeConfig(0xc0001eb9b0, 0x0, 0x0)
        github.com/git-town/git-town/v14/src/cmd/propose.go:119 +0x1b8
github.com/git-town/git-town/v14/src/cmd.executePropose(0x0, 0x0)
        github.com/git-town/git-town/v14/src/cmd/propose.go:67 +0xa6
github.com/git-town/git-town/v14/src/cmd.proposeCommand.func1(0xc000200008, {0x12a8860?, 0x4?, 0xc62e33?})
        github.com/git-town/git-town/v14/src/cmd/propose.go:47 +0x45
github.com/spf13/cobra.(*Command).execute(0xc000200008, {0x12a8860, 0x0, 0x0})
        github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001da308)
        github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/git-town/git-town/v14/src/cmd.Execute()
        github.com/git-town/git-town/v14/src/cmd/core.go:37 +0x619
main.main()
        github.com/git-town/git-town/v14/main.go:18 +0x1e

Additional information

If I redo git town propose and choose to continue the previous operation, it also result in SIGSEV

Handle unfinished command: continue

[parsec-v2-main-program] git merge --no-edit main
Already up to date.

[parsec-v2-main-program] git push -u origin parsec-v2-main-program
branch 'parsec-v2-main-program' set up to track 'origin/parsec-v2-main-program'.
Everything up-to-date
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6b0b60]

goroutine 1 [running]:
github.com/git-town/git-town/v14/src/vm/opcodes.(*CreateProposal).Run(0xc00012d9b0, {{0x0, 0x0}, 0xc0003b6020, 0xc0001181b0, 0xc000054cd0, 0xc000054ce0, 0xc0001301e0, 0xc0000256c0})
        github.com/git-town/git-town/v14/src/vm/opcodes/create_proposal.go:23 +0x80
github.com/git-town/git-town/v14/src/vm/interpreter/full.Execute({0xc00014a018, {0x0, 0x0}, 0xc0003b6020, 0x1, {{0xc000114459, 0x16}, {0xc000123b80, 0x3, 0x4}}, ...})
        github.com/git-town/git-town/v14/src/vm/interpreter/full/execute.go:27 +0x2a3
github.com/git-town/git-town/v14/src/validate.continueRunstate(0xc000146360, {{0x0, 0x0}, {0xc000114459, 0x16}, {0x12a8860, 0x0, 0x0}, 0x1, {{0xc000114459, ...}, ...}, ...})
        github.com/git-town/git-town/v14/src/validate/handle_unfinished_state.go:100 +0x1f8
github.com/git-town/git-town/v14/src/validate.HandleUnfinishedState({{0x0, 0x0}, {0xc000114459, 0x16}, {0x12a8860, 0x0, 0x0}, 0x1, {{0xc000114459, 0x16}, ...}, ...})
        github.com/git-town/git-town/v14/src/validate/handle_unfinished_state.go:48 +0x4c8
github.com/git-town/git-town/v14/src/execute.LoadRepoSnapshot({0xc00014a018, {0x12a8860, 0x0, 0x0}, 0x1, 0x1, 0xc0001182a0, {0x0, 0x1, 0x0, ...}, ...})
        github.com/git-town/git-town/v14/src/execute/load_repo_snapshot.go:23 +0x285
github.com/git-town/git-town/v14/src/cmd.determineProposeConfig(0xc0001182a0, 0x0, 0x0)
        github.com/git-town/git-town/v14/src/cmd/propose.go:119 +0x1b8
github.com/git-town/git-town/v14/src/cmd.executePropose(0x0, 0x0)
        github.com/git-town/git-town/v14/src/cmd/propose.go:67 +0xa6
github.com/git-town/git-town/v14/src/cmd.proposeCommand.func1(0xc0001fe008, {0x12a8860?, 0x4?, 0xc62e33?})
        github.com/git-town/git-town/v14/src/cmd/propose.go:47 +0x45
github.com/spf13/cobra.(*Command).execute(0xc0001fe008, {0x12a8860, 0x0, 0x0})
        github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001e2308)
        github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/git-town/git-town/v14/src/cmd.Execute()
        github.com/git-town/git-town/v14/src/cmd/core.go:37 +0x619
main.main()
        github.com/git-town/git-town/v14/main.go:18 +0x1e

The first git town propose that fail (not because of a SIGSEV):


I found the deprecated local setting "git-town.main-branch-name".
I am upgrading this setting to the new format "git-town.main-branch".

I found the deprecated local setting "git-town.perennial-branch-names".
I am upgrading this setting to the new format "git-town.perennial-branches".

[parsec-v2-main-program] git fetch --prune --tags
Selected parent branch for "parsec-v2-main-program": main

[parsec-v2-main-program] git add -A

[parsec-v2-main-program] git stash
Saved working directory and index state WIP on parsec-v2-main-program: 69505f0 Add `meta.mainProgram` for parsec-v2

[parsec-v2-main-program] git checkout main
Switched to branch 'main'
Your branch is ahead of 'origin/main' by 1 commit.
  (use "git push" to publish your local commits)

[main] git rebase origin/main
Current branch main is up to date.

[main] git push
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 727 bytes | 727.00 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
remote: error: GH013: Repository rule violations found for refs/heads/main.
remote: Review all repository rules at http://github.com/FirelightFlagboy/parsec-cloud-nix/rules?ref=refs%2Fheads%2Fmain
remote: 
remote: - 2 of 2 required status checks are expected.
remote: 
remote: - Changes must be made through a pull request.
remote: 
To github.com:FirelightFlagboy/parsec-cloud-nix.git
 ! [remote rejected] main -> main (push declined due to repository rule violations)
error: failed to push some refs to 'github.com:FirelightFlagboy/parsec-cloud-nix.git'


Error: exit status 1

To continue after having resolved conflicts, run "git town continue".
To go back to where you started, run "git town undo".
@FirelightFlagboy
Copy link
Author

The segfault come from that line:

prURL, err := args.Connector.NewProposalURL(self.Branch, parentBranch)

From the following line:

github.com/git-town/git-town/v14/src/vm/opcodes.(*CreateProposal).Run(0xc00012d9b0, {{0x0, 0x0}, 0xc0003b6020, 0xc0001181b0, 0xc000054cd0, 0xc000054ce0, 0xc0001301e0, 0xc0000256c0})

I assume the seconds arguments passed to CreateProposal.Run (shared.RunArgs) contains some null value (indicated by {0x0, 0x0})

From the definition of the struct RunArgs:

type RunArgs struct {
Connector hostingdomain.Connector
DialogTestInputs *components.TestInputs
Lineage configdomain.Lineage
PrependOpcodes func(...Opcode)
RegisterUndoablePerennialCommit func(gitdomain.SHA)
Runner *git.ProdRunner
UpdateInitialBranchLocalSHA func(gitdomain.LocalBranchName, gitdomain.SHA) error
}

It's likely that RunArgs.Connector is null (since it's the first element of the struct)

@kevgo
Copy link
Contributor

kevgo commented May 18, 2024

Thanks for submitting this detailed report! Yes, that's probably a null value blowing up in production 🤔. I'm in the middle of introducing Go's equivalent of the Rust Option for all nullable values to get rid of this problem once and for all.

@kevgo
Copy link
Contributor

kevgo commented Jun 6, 2024

@FirelightFlagboy v14.2.2 ships the fix for this. Please report when this problem still occurs. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants