surrealdb / surrealdb.go

SurrealDB SDK for Golang
https://surrealdb.com
Apache License 2.0
232 stars 60 forks source link

Bug: stack overflow error in gorilla websocket with db version 1.3.0 #130

Closed agufagit closed 5 months ago

agufagit commented 5 months ago

Describe the bug

got stack overflow error from gorilla websocket after idle for a while with db version 1.3.0

fatal error: stack overflow
stderr: github.com/gorilla/websocket.(*Conn).read(0xc0008b9600, 0x0?)
stderr:      /go/pkg/mod/github.com/gorilla/websocket@v1.5.1/conn.go:378 +0x26 fp=0xc000b43d80 sp=0xc000b43d28 pc=0x14c9a86

Steps to reproduce

idle for a while, an error is thrown from gorilla websocket

Expected behaviour

no error thrown

SurrealDB version

surreal 1.3.0

Contact Details

No response

Is there an existing issue for this?

Code of Conduct

thisisdev-patrick commented 5 months ago

I'm not sure if it's related, but I also have issues when a process runs for a longer time on the same connection. I switched to 1.3.0 (due to an index creation bug), and then I also had to use the main commit as package version since Change was renamed to Patch and such. When I ran the older version 1.2.2 and the v0.2.1 tag, I had no issues completing this run. (It should insert about 3.5 mln docs.)

INFO[2024-03-14 00:23:05] processed 10000 elements caller="pkg/digest/digest.go:129" fName="/pkg/digest.(digestor).readFile" INFO[2024-03-14 00:24:06] processed 20000 elements caller="pkg/digest/digest.go:129" fName="/pkg/digest.(digestor).readFile" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x10465c6d0] goroutine 34 [running]: github.com/surrealdb/surrealdb.go/pkg/conn/gorilla.(WebSocket).initialize.func1() /Users/sales/go/pkg/mod/github.com/surrealdb/surrealdb.go@v0.2.2-0.20240205063555-7c2584a964ab/pkg/conn/gorilla/gorilla.go:250 +0xa0 created by github.com/surrealdb/surrealdb.go/pkg/conn/gorilla.(WebSocket).initialize in goroutine 1 /Users/sales/go/pkg/mod/github.com/surrealdb/surrealdb.go@v0.2.2-0.20240205063555-7c2584a964ab/pkg/conn/gorilla/gorilla.go:238 +0x5c exit status 2

ElecTwix commented 5 months ago

@agufagit, it would be helpful if you could test with the custom non-official SurrealDB Golang Driver that uses the nhooyr's websocket implementation instead of gorilla: non-official library. Please share the results. If it works with the custom driver, the issue might be related to the Gorilla toolkit.

agufagit commented 5 months ago

@agufagit, it would be helpful if you could test with the custom non-official SurrealDB Golang Driver that uses the nhooyr's websocket implementation instead of gorilla: non-official library. Please share the results. If it works with the custom driver, the issue might be related to the Gorilla toolkit.

I'm using golang 1.22, it doesn't recognize your library in go.mod file bug

ElecTwix commented 5 months ago

Hi @agufagit, Seems like the error was fixed with 1.3.1. Could you close if your error is fixed for you thanks.