jkyberneees / low-http-server

HTTP Server implementation in top of uWebSocket.js
MIT License
50 stars 7 forks source link

Uncaught exception in low implementation #1

Closed jkyberneees closed 4 years ago

jkyberneees commented 4 years ago

🐛 Bug Report

Server crash when aborting wrk when using fast-proxy with 0http with low server Ref: https://github.com/fastify/fast-proxy/issues/35

To Reproduce

I have the following code: (Happens also without undici)

    const { proxy } = fastProxy({
      base: 'http://localhost:4000',
      undiciOptions: {
        connections: 4000,
        pipelining: 20,
        requestTimeout: 5000,
      },
    });
    const { router, server } = cero({
      server: low(),
    });

    router.all('/*', (req, res) => proxy(req, res, req.url, {}));

    server.listen(3000, (socket) => {
      if (socket) {
        console.log('HTTP server ready!');
      }
    });

With an additional restana server listening on port 4000 Then run wrk -t8 -c50 -d20s http://localhost:3000/api/v1/test hit CTRL-C to stop wrk.

Result: process abort on with the following error:

Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.
There was an uncaught exception. I'm now going to commit suicide; farewell all.

When I'm using 0http without low it doesn’t happen

Expected behavior

The process should not abort if I stop wrk

Your Environment