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

Crash by SQRT #7060

Closed
suyZhong opened this issue Nov 29, 2023 · 0 comments · Fixed by dolthub/go-mysql-server#2168
Closed

Crash by SQRT #7060

suyZhong opened this issue Nov 29, 2023 · 0 comments · Fixed by dolthub/go-mysql-server#2168
Assignees
Labels
bug Something isn't working customer issue panic

Comments

@suyZhong
Copy link

The following test case crashed go-mysql-server.

SELECT SQRT(-1) + 1;

Here's my error trace:

panic: Cannot create a Decimal from NaN

goroutine 542 [running]:
github.com/shopspring/decimal.newFromFloat(0xc001a00b00?, 0x171d13b?, 0x30000c0?)
        /home/suyang/go/pkg/mod/github.com/shopspring/decimal@v1.2.0/decimal.go:233 +0x387
github.com/shopspring/decimal.NewFromFloat(0xc000bc48c0?)
        /home/suyang/go/pkg/mod/github.com/shopspring/decimal@v1.2.0/decimal.go:209 +0x4c
github.com/dolthub/go-mysql-server/sql/expression.GetPrecisionAndScale({0x22c0620?, 0xc000ce2048?})
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/expression/div.go:555 +0x1a5
github.com/dolthub/go-mysql-server/sql/expression.convertToDecimalValue({0x22c0620?, 0xc000ce2048?}, 0x0?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/expression/div.go:401 +0x85
github.com/dolthub/go-mysql-server/sql/expression.(*Arithmetic).convertLeftRight(0xc000bc48c0, 0x1c192e0?, {0x22c0620?, 0xc000ce2048?}, {0x22c0760?, 0x4383a28?})
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/expression/arithmetic.go:262 +0x592
github.com/dolthub/go-mysql-server/sql/expression.(*Arithmetic).Eval(0xc000bc48c0, 0x7f716ed505b8?, {0xc000b64350?, 0x1?, 0x1?})
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/expression/arithmetic.go:201 +0x70
github.com/dolthub/go-mysql-server/sql/expression.(*Alias).Eval(0x412605?, 0x0?, {0xc000b64350?, 0xc000b64350?, 0xc000a04840?})
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/expression/alias.go:130 +0x22
github.com/dolthub/go-mysql-server/sql/rowexec.ProjectRow(0xc000bc4b40?, {0xc000e48970, 0x1, 0xc000cea508?}, {0xc000b64350, 0x1, 0x1})
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/rowexec/rel_iters.go:543 +0x2a5
github.com/dolthub/go-mysql-server/sql/rowexec.(*projectIter).Next(0xc000c83410, 0xc000c5a160?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/rowexec/rel_iters.go:517 +0x65
github.com/dolthub/go-mysql-server/sql/rowexec.transactionCommittingIter.Next(...)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/rowexec/transaction_iters.go:78
github.com/dolthub/go-mysql-server/sql/plan.(*trackedRowIter).Next(0xc000bc4bc0, 0xc000cea6b0?)
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/sql/plan/process.go:347 +0x24
github.com/dolthub/go-mysql-server/server.(*Handler).doQuery.func2()
        /home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20231128212821-dcb38e62c6af/server/handler.go:286 +0x125
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /home/suyang/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 537
        /home/suyang/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96

I originally find this issue in source code version 3c9d634. This could also be reproduced in v1.28.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer issue panic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants