Error shows up on subscription when the user closes the browser
Close the channel when user closes the browser window, the same as when the subscription is closed manually
input UserWhere {
id: String
name: String
age: Int16
role: String
}
type Query {
user(where: UserWhere): User
}
type Subscription {
userCreated: User!
}
gqlgen version? 0.12 arsmn fork for gofibergo version? 1.14runtime error: invalid memory address or nil pointer dereference
goroutine 483 [running]:
runtime/debug.Stack(0x1, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/arsmn/gqlgen/graphql.DefaultRecover(0x1ce0680, 0xc00061e700, 0x1936400, 0x22e9330, 0xc0008280a0, 0xc000080a40)
/Users/robertoortis/go/pkg/mod/github.com/arsmn/[email protected]/graphql/recovery.go:16 +0xa7
github.com/RobertoOrtis/gqlgen/graphql/handler/transport.(*wsConnection).subscribe.func1.1(0xc00089c000, 0x1ce0680, 0xc00061e700, 0xc00001fa20, 0xc00061e480)
/Users/robertoortis/go/pkg/mod/github.com/arsmn/[email protected]/graphql/handler/transport/websocket.go:231 +0x73
panic(0x1936400, 0x22e9330)
/usr/local/go/src/runtime/panic.go:969 +0x166
github.com/valyala/fasthttp.(*hijackConn).SetWriteDeadline(0xc000a35740, 0x0, 0x0, 0x0, 0x18c0100, 0xc000080cb0)
<autogenerated>:1 +0x2e
github.com/fasthttp/websocket.(*Conn).write(0xc000034160, 0x1, 0x0, 0x0, 0x0, 0xc000bb260c, 0x54, 0x1002, 0x0, 0x0, ...)
/Users/robertoortis/go/pkg/mod/github.com/fasthttp/[email protected]/conn.go:389 +0x100
github.com/fasthttp/websocket.(*messageWriter).flushFrame(0xc000e8c0f0, 0x1, 0x0, 0x0, 0x0, 0xc000818000, 0xa401120)
/Users/robertoortis/go/pkg/mod/github.com/fasthttp/[email protected]/conn.go:614 +0x222
github.com/fasthttp/websocket.(*messageWriter).Close(0xc000e8c0f0, 0x18c9c20, 0xc000b100c0)
/Users/robertoortis/go/pkg/mod/github.com/fasthttp/[email protected]/conn.go:724 +0x62
github.com/fasthttp/websocket.(*Conn).WriteJSON(0xc000034160, 0x18c9c20, 0xc000b100c0, 0x19801e0, 0xc000818001)
/Users/robertoortis/go/pkg/mod/github.com/fasthttp/[email protected]/json.go:29 +0x12e
github.com/arsmn/gqlgen/graphql/handler/transport.(*wsConnection).write(0xc00001fa20, 0xc000b100c0)
/Users/robertoortis/go/pkg/mod/github.com/arsmn/[email protected]/graphql/handler/transport/websocket.go:130 +0x6b
github.com/arsmn/gqlgen/graphql/handler/transport.(*wsConnection).sendResponse(0xc00001fa20, 0x222def1, 0x1, 0xc000b10040)
/Users/robertoortis/go/pkg/mod/github.com/arsmn/[email protected]/graphql/handler/transport/websocket.go:258 +0xe5
github.com/arsmn/gqlgen/graphql/handler/transport.(*wsConnection).subscribe.func1(0xc00089c000, 0x1ce0680, 0xc00061e700, 0xc00001fa20, 0xc00061e480, 0xc000c208c0)
/Users/robertoortis/go/pkg/mod/github.com/arsmn/[email protected]/graphql/handler/transport/websocket.go:242 +0x121
created by github.com/arsmn/gqlgen/graphql/handler/transport.(*wsConnection).subscribe
/Users/robertoortis/go/pkg/mod/github.com/arsmn/[email protected]/graphql/handler/transport/websocket.go:228 +0x73e
if the subscription is closed manually by the users, there are no issues, everything works as intended. The problem is when the user disconnects from the subscription abruptly, whether by closing the browser window or losing the internet connection.
Looks like you're using a fork of gqlgen? You might want to report the issue over there :)
Looks like you're using a fork of gqlgen? You might want to report the issue over there :)
Unfortunately it is not possible.
Hi @RobertoOrtis
It's possible to open issue now