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

random panic #7

Open
SoMuchForSubtlety opened this issue Jul 31, 2019 · 2 comments
Open

random panic #7

SoMuchForSubtlety opened this issue Jul 31, 2019 · 2 comments

Comments

@SoMuchForSubtlety
Copy link

I sometimes get this when trying to connect.
seems to happen randomly, I don't change anything.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x228b60]

goroutine 28 [running]:
github.com/gorilla/websocket.(*Conn).NextReader(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/pi/go/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:938 +0x14
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/pi/go/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:1028 +0x1c
github.com/Memelabs/dggchat.(*Session).listen(0x20824d0)
        /home/pi/go/pkg/mod/github.com/!memelabs/dggchat@v0.0.0-20171209033102-97642b4d160e/session.go:164 +0x24
created by github.com/Memelabs/dggchat.(*Session).open
        /home/pi/go/pkg/mod/github.com/!memelabs/dggchat@v0.0.0-20171209033102-97642b4d160e/session.go:115 +0xfc
@xDashh
Copy link
Member

xDashh commented Jul 31, 2019

Iirc there was some race condition with wanting to access the list of connected users before the NAMES message was fully parsed or something along these lines... Try go build -race etc. and you should find it.

@SoMuchForSubtlety
Copy link
Author

SoMuchForSubtlety commented Jul 31, 2019

yea it seems to be a race, I think I cause it by closing the connection very quickly after opening it.

this is the output when I just open the connection and immediately close it.
I get this very consistently

$ go run -race .\main.go
==================
WARNING: DATA RACE
Write at 0x00c000050470 by main goroutine:
  github.com/MemeLabs/dggchat.(*Session).Close()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:138 +0x118
  main.main()
      C:/Users/jakob/Documents/projects/test/main.go:29 +0x486

Previous read at 0x00c000050470 by goroutine 13:
  github.com/MemeLabs/dggchat.(*Session).listen()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:164 +0x63

Goroutine 13 (running) created at:
  github.com/MemeLabs/dggchat.(*Session).open()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:115 +0x219
  github.com/MemeLabs/dggchat.(*Session).Open()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:91 +0xe1
  main.main()
      C:/Users/jakob/Documents/projects/test/main.go:24 +0x426
==================
Found 1 data race(s)
exit status 66

this is the output when I open the connection, send one message and then close it.
I only got this twice, otherwise it ran normally

==================
WARNING: DATA RACE
Read at 0x00c000050470 by goroutine 13:
  github.com/MemeLabs/dggchat.(*Session).listen()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:164 +0x63 

Previous write at 0x00c000050470 by main goroutine:
  github.com/MemeLabs/dggchat.(*Session).Close()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:138 +0x118
  main.main()
      C:/Users/jakob/Documents/projects/test/main.go:36 +0x5ca

Goroutine 13 (running) created at:
  github.com/MemeLabs/dggchat.(*Session).open()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:115 +0x219
  github.com/MemeLabs/dggchat.(*Session).Open()
      C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:91 +0xe1  
  main.main()
      C:/Users/jakob/Documents/projects/test/main.go:26 +0x426
==================
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x78fc8f]

goroutine 8 [running]:
github.com/gorilla/websocket.(*Conn).NextReader(0x0, 0xc000062b70, 0x46d09c, 0x401d80, 0x1913588, 0x0)
        C:/Users/jakob/go/src/github.com/gorilla/websocket/conn.go:939 +0x4f
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0, 0x6f, 0x2, 0xc0001640a0, 0x2, 0x4, 0x0)
        C:/Users/jakob/go/src/github.com/gorilla/websocket/conn.go:1029 +0x58
github.com/MemeLabs/dggchat.(*Session).listen(0xc0000503c0)
        C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:164 +0x7c
created by github.com/MemeLabs/dggchat.(*Session).open
        C:/Users/jakob/go/src/github.com/MemeLabs/dggchat/session.go:115 +0x21a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants