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/[email protected]/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/[email protected]/conn.go:1028 +0x1c
github.com/Memelabs/dggchat.(*Session).listen(0x20824d0)
        /home/pi/go/pkg/mod/github.com/!memelabs/[email protected]/session.go:164 +0x24
created by github.com/Memelabs/dggchat.(*Session).open
        /home/pi/go/pkg/mod/github.com/!memelabs/[email protected]/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