named-data / YaNFD

Yet another Named Data Networking Forwarding Daemon
https://pkg.go.dev/github.com/named-data/YaNFD
MIT License
12 stars 10 forks source link

WebSocket face frequently crashes when there are multiple connections #56

Closed zjkmxy closed 11 months ago

zjkmxy commented 11 months ago

The error message.

panic: concurrent write to websocket connection

goroutine 2579 [running]:
github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc000585af0, 0x1, {0xc0004c7ec0?, 0x2?, 0x2?})
        <SNIP>/Go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:617 +0x4b8
github.com/gorilla/websocket.(*Conn).WriteMessage(0xc0000fe580, 0xc00029c000?, {0xc0004c7ec0, 0x5c, 0x5c})
        <SNIP>/Go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:770 +0x127
github.com/named-data/YaNFD/face.(*WebSocketTransport).sendFrame(0xc00029c000, {0xc0004c7ec0, 0x5c, 0x5c})
        E:/YaNFD/face/web-socket-transport.go:67 +0xc5
github.com/named-data/YaNFD/face.sendPacket(0xc0000fe840, 0xc00038c8c0)
        E:/YaNFD/face/ndnlp-link-service.go:356 +0x5db
created by github.com/named-data/YaNFD/face.(*NDNLPLinkService).runSend in goroutine 1135
        E:/YaNFD/face/ndnlp-link-service.go:374 +0x3dd

Test machine is Windows 11.

zjkmxy commented 11 months ago

Ref: https://github.com/named-data/YaNFD/blob/a329946e6b9cbd46606f5ba5ad38bb5d40cd1db6/face/ndnlp-link-service.go#L370