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

SIGSEGV when attempting to create a new branch while in detached head state. #5839

Closed
nicktobey opened this issue Apr 28, 2023 · 2 comments
Closed
Assignees
Labels
bug Something isn't working good repro Easily reproducible bugs panic

Comments

@nicktobey
Copy link
Contributor

nicktobey commented Apr 28, 2023

Repro example:

nick@Nicks-MBP testdolt % dolt sql
# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
testdolt> call dolt_tag("v4");
+--------+
| status |
+--------+
| 0      |
+--------+
1 row in set (0.01 sec)

testdolt> use `testdolt/v4`;
Database changed
testdolt/v4> call dolt_checkout("-b", "v5");
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1059d05d4]

Stack trace:

goroutine 1 [running]:
github.com/dolthub/dolt/go/libraries/doltcore/doltdb.(*WorkingSet).Ref(...)
	/Users/nick/Documents/dolt/go/libraries/doltcore/doltdb/workingset.go:338
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess.SessionStateAdapter.CWBHeadRef({0x140006b6bd0, {0x1400100e3b0, 0xb}, 0x0, 0x0, 0x14001008db0})
	/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dsess/session_state_adapter.go:71 +0x74
github.com/dolthub/dolt/go/libraries/doltcore/env/actions.createBranch({0x1067bb900, 0x140001c1e00}, {0x1400013a0a0, {0x1067cdf50, 0x14001008e10}, {0x1067c03e0, 0x14001008de0}}, {0x1400100e974, 0x2}, {0x105d4c59c, ...}, ...)
	/Users/nick/Documents/dolt/go/libraries/doltcore/env/actions/branch.go:326 +0x5c
github.com/dolthub/dolt/go/libraries/doltcore/env/actions.CreateBranchWithStartPt({0x1067bb900, 0x140001c1e00}, {0x1400013a0a0, {0x1067cdf50, 0x14001008e10}, {0x1067c03e0, 0x14001008de0}}, {0x1400100e974, 0x2}, {0x105d4c59c, ...}, ...)
	/Users/nick/Documents/dolt/go/libraries/doltcore/env/actions/branch.go:271 +0x60
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.checkoutNewBranch(0x106496e00?, {0x1400100ed60, 0x8}, {0x1400013a0a0, {0x1067cdf50, 0x14001008e10}, {0x1067c03e0, 0x14001008de0}}, 0x14001009800)
	/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_checkout.go:262 +0x278
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.doDoltCheckout(0x140001c1e00, {0x14001054b20, 0x2, 0x2})
	/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_checkout.go:76 +0x418
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.doltCheckout(0x14001311848?, {0x14001054b20?, 0x2?, 0x2?})
	/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_checkout.go:38 +0x20
reflect.Value.call({0x1064793a0?, 0x106794b00?, 0x3fffffff?}, {0x105d4bd98, 0x4}, {0x1400102a780, 0x3, 0x1063d5ee0?})
	/usr/local/go/src/reflect/value.go:586 +0x87c
reflect.Value.Call({0x1064793a0?, 0x106794b00?, 0x1067e2ae0?}, {0x1400102a780?, 0x1063d5ee0?, 0x140010018a0?})
	/usr/local/go/src/reflect/value.go:370 +0x90
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildExternalProcedure(0x0?, 0x140001c1e00, 0x14000408770, {0x0?, 0x0?, 0x0?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/rel.go:547 +0x458
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14001312348?, 0x1047f06e4?, {0x1067c3af0?, 0x14000408770?}, {0x0?, 0x0, 0x0})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/node_builder.gen.go:129 +0xfb8
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildProcedure(0x140013122f8?, 0x1047f8980?, 0x14001312358?, {0x0?, 0x140013123b8?, 0x1047f06e4?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/rel.go:267 +0x3c
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14001001670?, 0x1400100ec28?, {0x1067c4510?, 0x140010448f0?}, {0x0?, 0x0, 0x0})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/node_builder.gen.go:217 +0x1a58
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildCall(0x1400102c9c0?, 0x14000701560?, 0x14000701560, {0x0, 0x0, 0x0})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/proc.go:175 +0x1f8
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x1067c4678?, 0x1067c2db8?, {0x1067c2db8?, 0x14000701560?}, {0x0?, 0x14000701560?, 0x1?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/node_builder.gen.go:79 +0x96c
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).Build(...)
	/Users/nick/Documents/go-mysql-server/sql/rowexec/builder.go:33
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildTransactionCommittingNode(0x1?, 0x1?, 0x0?, {0x0?, 0x0?, 0x0?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/transaction.go:312 +0x3c
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14001312ba8?, 0x10597bfe8?, {0x1067c54d0?, 0x14001001820?}, {0x0?, 0x14000700ea0?, 0x0?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/node_builder.gen.go:37 +0x114
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).Build(...)
	/Users/nick/Documents/go-mysql-server/sql/rowexec/builder.go:33
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildQueryProcess(0x140013129d8?, 0x1059c7318?, 0x1400102c9c0, {0x0?, 0x1400100e800?, 0x140013129c0?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/other.go:350 +0x40
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0xfd?, 0x10597bf50?, {0x1067c4678?, 0x1400102c9c0?}, {0x0?, 0x10597ad40?, 0x14000aeedb8?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/node_builder.gen.go:43 +0x1a4
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).Build(0x14000661270?, 0x140001c1e00?, {0x1067c4678?, 0x1400102c9c0?}, {0x0?, 0x14000700ea0?, 0x0?})
	/Users/nick/Documents/go-mysql-server/sql/rowexec/builder.go:33 +0x28
github.com/dolthub/go-mysql-server.(*Engine).QueryNodeWithBindings(0x14000661270, 0x140001c1e00, {0x14001018420, 0x1e}, {0x0?, 0x0?}, 0xf0?)
	/Users/nick/Documents/go-mysql-server/engine.go:270 +0x21c
github.com/dolthub/go-mysql-server.(*Engine).QueryWithBindings(...)
	/Users/nick/Documents/go-mysql-server/engine.go:212
github.com/dolthub/go-mysql-server.(*Engine).Query(0x14001312cd8?, 0x104eefaf8?, {0x14001018420?, 0x10675ce20?})
	/Users/nick/Documents/go-mysql-server/engine.go:207 +0x2c
github.com/dolthub/dolt/go/cmd/dolt/commands/engine.(*SqlEngine).Query(...)
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/engine/sqlengine.go:253
github.com/dolthub/dolt/go/cmd/dolt/commands.processParsedQuery(0x14001018420?, {0x14001018420?, 0x1067bc1f8?}, 0x1400100ba80?, {0x1067ae0d8?, 0x14000700de0?})
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/sql.go:1138 +0x3cc
github.com/dolthub/dolt/go/cmd/dolt/commands.processQuery(0x1067bc1f8?, {0x14001018420, 0x1e}, 0x140006b6bd0?)
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/sql.go:1091 +0xc8
github.com/dolthub/dolt/go/cmd/dolt/commands.execShell.func3.1({0x1067bb040, 0x14000226f90}, 0x1400012ac10, 0x14000b44110, 0x14000256240, 0x14000000280, 0x14001312fa0, 0x14001312f60, {0x14001018420, 0x1e}, ...)
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/sql.go:931 +0x244
github.com/dolthub/dolt/go/cmd/dolt/commands.execShell.func3(0x14000000280?)
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/sql.go:949 +0x3d4
github.com/dolthub/ishell.handleUninterpretedInput(0x14000000280, {0x14001018420, 0x1f})
	/Users/nick/go/pkg/mod/github.com/dolthub/ishell@v0.0.0-20221214210346-d7db0b066488/ishell.go:294 +0x204
github.com/dolthub/ishell.(*Shell).run(0x14000000280)
	/Users/nick/go/pkg/mod/github.com/dolthub/ishell@v0.0.0-20221214210346-d7db0b066488/ishell.go:247 +0x30c
github.com/dolthub/ishell.(*Shell).Run(0x14000000280?)
	/Users/nick/go/pkg/mod/github.com/dolthub/ishell@v0.0.0-20221214210346-d7db0b066488/ishell.go:141 +0x28
github.com/dolthub/dolt/go/cmd/dolt/commands.execShell(0x14000662d20, 0x14000256240)
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/sql.go:959 +0x5f4
github.com/dolthub/dolt/go/cmd/dolt/commands.SqlCmd.Exec({{0x105d506f7?, 0x83c952fee493fb68?}}, {0x1067bb040, 0x14000226f90}, {0x140006904d0, 0x8}, {0x14000134010, 0x0, 0x0}, 0x140006c0630, ...)
	/Users/nick/Documents/dolt/go/cmd/dolt/commands/sql.go:319 +0xdec
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.handleCommand({{0x105d4c464, 0x4}, {0x105d679fc, 0x11}, {0x0, 0x0}, {0x1400044dc00, 0x32, 0x32}, 0x0}, ...)
	/Users/nick/Documents/dolt/go/cmd/dolt/cli/command.go:237 +0x3fc
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec({{0x105d4c464, 0x4}, {0x105d679fc, 0x11}, {0x0, 0x0}, {0x1400044dc00, 0x32, 0x32}, 0x0}, ...)
	/Users/nick/Documents/dolt/go/cmd/dolt/cli/command.go:186 +0x258
main.runMain()
	/Users/nick/Documents/dolt/go/cmd/dolt/dolt.go:406 +0x73c
main.main()
	/Users/nick/Documents/dolt/go/cmd/dolt/dolt.go:144 +0x1c

call dolt_branch("v5"); prints an identical stack trace.

@nicktobey nicktobey self-assigned this Apr 28, 2023
@timsehn timsehn added bug Something isn't working panic good repro Easily reproducible bugs labels Apr 28, 2023
@timsehn
Copy link
Sponsor Contributor

timsehn commented Apr 28, 2023

Good find.

@nicktobey
Copy link
Contributor Author

Closing in favor of #5871

@nicktobey nicktobey closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good repro Easily reproducible bugs panic
Projects
None yet
Development

No branches or pull requests

2 participants