Skip to content

Major performance issue with hapi.js 15.x #3347

@lostthetrail

Description

@lostthetrail

What are you trying to achieve or the steps to reproduce?

Under higher concurrency Hapi 15.x memory usage spikes and fails, where Hapi 14.x had no problem

'use strict';

const Hapi = require('hapi');
const hoek = require('hoek');

const server = new Hapi.Server({
    connections: {
        router: {
            stripTrailingSlash: true
        }
    }
});

server.connection({
    port: process.env.NODE_PORT || 8080,
    host: process.env.HOSTNAME || '0.0.0.0',
    routes: {
        response: {
            emptyStatusCode: 204
        }
    }
});

server.route([
    {
        method: 'GET',
        path: '/validate',
        handler: function handle(request, reply) {
            return reply({
                validate: true
            });
        }
    }
]);

server.start(function handleServerStart(serverStartErr) {
    hoek.assert(!serverStartErr, serverStartErr);
    console.log(`Server running at: ${server.info.uri}`);
});
artillery quick --duration 60 --rate 100 -n 100 http://localhost:8080/validate

What was the result you received?

With Hapi 15.x, you will see a "JavaScript heap out of memory" and it will fail.
With Hapi 14.x, you will have a successful test and have zero errors.

What did you expect?

No major failures and zero errors.

Context

  • node version: 6.5.0 & 4.5.0
  • hapi version: 15.0.3
  • os: OSX & Centos
  • any other relevant information: I am aware this is a very high RPS to push through a server. But it is an attack vector. I also was able to replicate this with JMeter, so the load tool isn't important in this case. Just high concurrency and RPS.

Metadata

Metadata

Assignees

Labels

bugBug or defectdependencyUpdate module dependencysecurityIssue with security impact

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions