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

segfault when using turso db shell #891

Closed
MarinPostma opened this issue Jul 18, 2024 · 2 comments · Fixed by #892
Closed

segfault when using turso db shell #891

MarinPostma opened this issue Jul 18, 2024 · 2 comments · Fixed by #892
Labels
bug Something isn't working

Comments

@MarinPostma
Copy link

Version:

turso version v0.96.1

steps

  • start sqld locally
  • run turso db shell ws://localhost:8080
  • enjoy:
 turso db shell ws://localhost:8080
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0xe8 pc=0x104a03df4]

goroutine 1 [running]:
nhooyr.io/websocket.(*Conn).SetReadLimit(...)
        /home/runner/go/pkg/mod/nhooyr.io/websocket@v1.8.10/read.go:94
github.com/tursodatabase/libsql-client-go/libsql/internal/ws.connect({0x140001aea50, 0x13}, {0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/tursodatabase/libsql-client-go@v0.0.0-20240715111033-518abad12431/libsql/internal/ws/websockets.go:205 +0xe4
github.com/tursodatabase/libsql-client-go/libsql/internal/ws.Connect({0x140001aea50?, 0x140001f3b08?}, {0x0?, 0x104438f18?})
        /home/runner/go/pkg/mod/github.com/tursodatabase/libsql-client-go@v0.0.0-20240715111033-518abad12431/libsql/internal/ws/driver.go:57 +0x24
github.com/tursodatabase/libsql-client-go/libsql.wsConnector.Connect(...)
        /home/runner/go/pkg/mod/github.com/tursodatabase/libsql-client-go@v0.0.0-20240715111033-518abad12431/libsql/sql.go:191
database/sql.(*DB).conn(0x140002a0ea0, {0x104d4f700, 0x105392140}, 0x1)
        /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/src/database/sql/sql.go:1415 +0x824
database/sql.(*DB).exec(0x140002a0ea0, {0x104d4f700, 0x105392140}, {0x104a8919d, 0x9}, {0x0, 0x0, 0x0}, 0x20?)
        /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/src/database/sql/sql.go:1679 +0x40
database/sql.(*DB).ExecContext.func1(0xb8?)
        /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/src/database/sql/sql.go:1662 +0x54
database/sql.(*DB).retry(0x104d4f700?, 0x14000049600)
        /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/src/database/sql/sql.go:1566 +0x4c
database/sql.(*DB).ExecContext(0x0?, {0x104d4f700?, 0x105392140?}, {0x104a8919d?, 0x140000498e0?}, {0x0?, 0x1400029c5e0?, 0x10462bd50?})
        /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/src/database/sql/sql.go:1661 +0x94
database/sql.(*DB).Exec(...)
        /home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-amd64/src/database/sql/sql.go:1675
github.com/libsql/libsql-shell-go/internal/db.(*Db).TestConnection(0x140001aea20?)
        /home/runner/go/pkg/mod/github.com/libsql/libsql-shell-go@v0.10.2/internal/db/db.go:109 +0x48
github.com/libsql/libsql-shell-go/pkg/shell.RunShell({{0x140001aea20, 0x13}, {0x0, 0x0}, {0x0, 0x0}, {0x104d4a328, 0x14000198028}, {0x104d4a308, 0x14000198030}, ...})
        /home/runner/go/pkg/mod/github.com/libsql/libsql-shell-go@v0.10.2/pkg/shell/shell.go:36 +0xb8
github.com/tursodatabase/turso-cli/internal/cmd.runShell({0x0, 0x0}, {{0x140001aea20, 0x13}, {0x0, 0x0}, {0x0, 0x0}, {0x104d4a328, 0x14000198028}, ...})
        /home/runner/work/turso-cli/turso-cli/internal/cmd/db_shell.go:233 +0x4c
github.com/tursodatabase/turso-cli/internal/cmd.init.func23(0x105314f00, {0x1400019b3a0, 0x1, 0x104a8357f?})
        /home/runner/work/turso-cli/turso-cli/internal/cmd/db_shell.go:228 +0xaf4
github.com/spf13/cobra.(*Command).execute(0x105314f00, {0x1400019b370, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x654
github.com/spf13/cobra.(*Command).ExecuteC(0x10531a820)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/tursodatabase/turso-cli/internal/cmd.Execute()
        /home/runner/work/turso-cli/turso-cli/internal/cmd/root.go:25 +0x24
main.main()
        /home/runner/work/turso-cli/turso-cli/cmd/turso/main.go:6 +0x1c
@MarinPostma MarinPostma added the bug Something isn't working label Jul 18, 2024
@MarinPostma
Copy link
Author

additional information: it seems to be because the sever refuses the connection:

2024-07-18T12:04:02.701195Z  INFO libsql_server::connection::libsql: setting PRAGMA synchronous to relaxed
2024-07-18T12:04:02.701776Z  INFO libsql_server::connection::libsql: setting PRAGMA synchronous to relaxed
2024-07-18T12:06:20.918786Z  INFO libsql_server::hrana::ws: Received HTTP upgrade connection #0
2024-07-18T12:06:20.919870Z ERROR libsql_server::hrana::ws: HTTP upgrade connection #0 failed: Could not perform the WebSocket handshake on HTTP connection

Caused by:
    Invalid host header: `host header should be in the format <namespace>.<...>`

@MarinPostma
Copy link
Author

fixed by tursodatabase/libsql-client-go#128

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

Successfully merging a pull request may close this issue.

1 participant