raff / godet

Remote client for Chrome DevTools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Close() while sending/receiving data over the websocket panics

iafan opened this issue · comments

Sometimes calling remote.Close() while websocket is busy communicating results in a panic:

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

goroutine 37 [running]:
github.com/gorilla/websocket.(*Conn).WriteMessage(0x0, 0x1, 0xc420222000, 0x8d, 0xb9, 0x0, 0x0)
	/Users/iafanasyev/.go/src/github.com/gorilla/websocket/conn.go:735 +0x37
github.com/raff/godet.(*RemoteDebugger).sendMessages(0xc420164120)
	/Users/iafanasyev/.go/src/github.com/raff/godet/godet.go:394 +0x1b5
created by github.com/raff/godet.Connect
	/Users/iafanasyev/.go/src/github.com/raff/godet/godet.go:235 +0x267

In my case remote.Close() is called from a gorountine.

Can you update and try again ?

I can no longer reproduce the panic with your fix. You can close the ticket. Thanks!