surrealdb.go icon indicating copy to clipboard operation
surrealdb.go copied to clipboard

Bug: Re-connection to the DB

Open iliesh opened this issue 8 months ago • 2 comments

Describe the bug

When the application is running, and the DB is restarted, then the application panic with the following stack:

panic: repeated read on failed websocket connection

goroutine 50 [running]:
github.com/gorilla/websocket.(*Conn).NextReader(0xc0000e0580)
        /home/admin/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1030 +0x4f4
github.com/gorilla/websocket.(*Conn).ReadMessage(0x129dfa0?)
        /home/admin/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1093 +0x2f
github.com/surrealdb/surrealdb.go/internal/websocket.(*WebSocket).read(0xc00039c080, {0xca5720, 0xc0003f4480})
        /home/admin/go/pkg/mod/github.com/surrealdb/[email protected]/internal/websocket/ws.go:140 +0x45
github.com/surrealdb/surrealdb.go/internal/websocket.(*WebSocket).initialize.func1()
        /home/admin/go/pkg/mod/github.com/surrealdb/[email protected]/internal/websocket/ws.go:167 +0xac
created by github.com/surrealdb/surrealdb.go/internal/websocket.(*WebSocket).initialize in goroutine 1
        /home/admin/go/pkg/mod/github.com/surrealdb/[email protected]/internal/websocket/ws.go:160 +0x8e
exit status 2

Steps to reproduce

run an application and then stop surrealdb

Expected behaviour

reconnect or return back an error to the application, and let developer decide what to do

SurrealDB version

1.0.0+20230913.54aedcd for linux on x86_64

Contact Details

[email protected]

Is there an existing issue for this?

  • [X] I have searched the existing issues

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

iliesh avatar Oct 29 '23 23:10 iliesh