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

Websocket: Invalid memory address on fireOnLeave #782

Closed
jerson opened this Issue Oct 11, 2017 · 0 comments

Comments

Projects
None yet
3 participants
@jerson
Contributor

jerson commented Oct 11, 2017

when there are many concurrent connections and disconnects, fireOnLeave fails. steps to reproduce:

  1. tested with https://github.com/observing/thor
git clone https://github.com/observing/thor
cd thor
./bin/thor  --amount 5000 ws://localhost:8088/yourwspath 
  1. Displays the following error message
[HTTP Server] http: panic serving 127.0.0.1:40392: runtime error: invalid memory address or nil pointer dereference
goroutine 612 [running]:
net/http.(*conn).serve.func1(0xc420aab180)
        /usr/local/go/src/net/http/server.go:1697 +0xd0
panic(0xc538a0, 0x126da00)
        /usr/local/go/src/runtime/panic.go:491 +0x283
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*connection).fireOnLeave(0x0, 0xc42313c2c0, 0x40)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/connection.go:481 +0x22
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*Server).LeaveAll(0xc420566410, 0xc42313c2c0, 0x40)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/server.go:261 +0x186
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*Server).Disconnect(0xc420566410, 0xc42313c2c0, 0x40, 0xc4238fb980, 0x0)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/server.go:375 +0x43
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*connection).Disconnect(0xc422f498c0, 0xc420bcc928, 0xc4238fb980)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/connection.go:487 +0x44
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*connection).startReader.func2(0xc422f498c0)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/connection.go:327 +0x2b
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*connection).startReader(0xc422f498c0)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/connection.go:348 +0x1b1
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*Server).handleConnection(0xc420566410, 0x1249300, 0xc422f3db90, 0x123d440, 0xc422fbaa00)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/server.go:197 +0x192
miapp.com/api/vendor/github.com/kataras/iris/websocket.(*Server).Handler.func1(0x1249300, 0xc422f3db90)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/websocket/server.go:166 +0x26a
miapp.com/api/vendor/github.com/kataras/iris/context.Do(0x1249300, 0xc422f3db90, 0xc4204e4180, 0x1, 0x1)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/context/context.go:837 +0x81
miapp.com/api/vendor/github.com/kataras/iris/context.(*context).Do(0xc422f3db90, 0xc4204e4180, 0x1, 0x1)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/context/context.go:979 +0x55
miapp.com/api/vendor/github.com/kataras/iris/core/router.(*routerHandler).HandleRequest(0xc4200e6240, 0x1249300, 0xc422f3db90)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/core/router/handler.go:216 +0x538
miapp.com/api/vendor/github.com/kataras/iris/core/router.(*Router).BuildRouter.func1(0x1236140, 0xc422f76e00, 0xc420b1a300)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/core/router/router.go:70 +0x8f
miapp.com/api/vendor/github.com/kataras/iris/core/router.(*Router).ServeHTTP(0xc4204ea680, 0x1236140, 0xc422f76e00, 0xc420b1a300)
        /home/gerson/go/src/miapp.com/api/vendor/github.com/kataras/iris/core/router/router.go:147 +0x48
net/http.serverHandler.ServeHTTP(0xc42008c4e0, 0x1236140, 0xc422f76e00, 0xc420b1a300)
        /usr/local/go/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc420aab180, 0x12395c0, 0xc420a57480)
        /usr/local/go/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2720 +0x288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment