fidm / quic

[DEPRECATED, recommended https://github.com/nodejs/quic] A QUIC server/client implementation in Node.js
MIT License
130 stars 13 forks source link

Repeated stress leads to unknown error code #12

Open splitice opened 6 years ago

splitice commented 6 years ago

On heavy usage (stream create, server write, server read, stream end) the server ends up getting into a state where it constantly errors for the session. The error is:

qtunnel:server INVALID_ERROR_CODE: 4294967295
    at Function.fromBuffer (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/internal/error.js:487:16)
    at Function.fromBuffer (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/internal/frame.js:881:41)
    at Object.parseFrame (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/internal/frame.js:56:35)
    at RegularPacket.parseFrames (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/internal/packet.js:325:36)
    at ServerSession._handleRegularPacket (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/session.js:199:16)
    at serverOnMessage (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/server.js:252:17)
    at Socket.socket.on.on.on (/opt/qtunnel/localtunnel-server/node_modules/quic/dist/server.js:77:44)
    at Socket.emit (events.js:180:13)
    at UDP.onMessage [as onmessage] (dgram.js:659:8) +217ms
splitice commented 6 years ago

The error code is the RST invalid code. It looks like the server is not correctly handling RST's.

splitice commented 6 years ago

I fixed the cause, however the handling could be alot better. I'll leave this open until you have investigated.

splitice commented 6 years ago

Another way this error occurs is if the client sends "QUIC_TOO_MANY_AVAILABLE_STREAMS: The peer created too many available streams". This is either not encoded correctly - or not decoded correctly.