jehervy/node-virtual-gamepads

Touchpad crashed

robsdedude opened this issue · 3 comments

Had the server running on recalbox x64 v4.1 (node v6.9.1). Opened the touchpad and moved the mouse a little (in Kodi). It suddenly crashed. Happed twice but couldn't reporduce a third time...

/usr/node-virtual-gamepads/node_modules/ws/lib/Receiver.js:386
    default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break;
                       ^

RangeError: out of range index
    at RangeError (native)
    at fastCopy (/usr/node-virtual-gamepads/node_modules/ws/lib/Receiver.js:386:24)
    at Receiver.add (/usr/node-virtual-gamepads/node_modules/ws/lib/Receiver.js:86:3)
    at Socket.realHandler (/usr/node-virtual-gamepads/node_modules/ws/lib/WebSocket.js:800:20)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)

I guess it's a good idea in general to add a catch block that catches all exceptions, log them and ignores them to keep the service running.

Probably a version problem: websockets/ws#778

Couldn't reproduce. I hope bumping socket.io in order to make it use ws 1.1.4 fixes it.