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

Dolt sql-server panics on unknown variable #6546

Closed
fulghum opened this issue Aug 21, 2023 · 2 comments · Fixed by dolthub/go-mysql-server#1959
Closed

Dolt sql-server panics on unknown variable #6546

fulghum opened this issue Aug 21, 2023 · 2 comments · Fixed by dolthub/go-mysql-server#1959
Assignees
Labels
bug Something isn't working good repro Easily reproducible bugs panic

Comments

@fulghum
Copy link
Contributor

fulghum commented Aug 21, 2023

In Dolt version 1.12.0, when a dolt sql-server processes a request for an unknown user variable (e.g. select @foo;) the process panics and exits. This only seems to happen with a running sql server; not with the dolt sql shell.

Client repro:

mysql> select @foo;
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (61)
ERROR: 
Can't connect to the server

Server logs:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x58 pc=0x101f13e44]

goroutine 122 [running]:
github.com/dolthub/go-mysql-server/server.schemaToFields(0x140004c4ee8?, {0x1400007e8e8, 0x1, 0x10192a730?})
	github.com/dolthub/[email protected]/server/handler.go:607 +0xc4
github.com/dolthub/go-mysql-server/server.(*Handler).doQuery.func4()
	github.com/dolthub/[email protected]/server/handler.go:326 +0x110
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 21
	golang.org/x/[email protected]/errgroup/errgroup.go:72 +0x98
@fulghum fulghum added bug Something isn't working panic good repro Easily reproducible bugs labels Aug 21, 2023
@fulghum fulghum self-assigned this Aug 21, 2023
@fulghum
Copy link
Contributor Author

fulghum commented Aug 21, 2023

Looks like column.Type is nil when vitess goes to send back the field/type metadata over the wire and causes this panic. Filling this in with types.Null seems to be enough to make it work correctly. I'll do a little more testing and tidying up and get a PR open for the fix.

This is another bug that only manifests when we go through the wire serialization code. @zachmu started work last week to get our existing tests to run over a sql-server connection, so very soon we should have protection against issues like this getting past our tests.

@fulghum
Copy link
Contributor Author

fulghum commented Aug 21, 2023

Have a fix in place for user variables; looks like system variables have a similar crash, digging into that now.

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

Successfully merging a pull request may close this issue.

1 participant