Skip to content
This repository was archived by the owner on Jul 15, 2020. It is now read-only.
This repository was archived by the owner on Jul 15, 2020. It is now read-only.

Memory leak in app created from this boilerplate #117

@dongrh214

Description

@dongrh214

Bug report

We have some problem on our server. After some time of execution we have an out of memory error on our server.
So I tried to reproduce on my computer. I create a clean project just use nextjs-starter. and build it.run it using pm2, after one three to see if the memory increase.
Here is the memory evolution :

b882ca53-727a-4c84-b014-b1e9dbcd9b61

pm2 monit show like this:

64d616e1-1bce-4d22-8311-7c0ef85441a4
6dafeb61-ee62-41c8-af3f-82a3d16eab5c

Describe the bug

you can see the heap size awaly increasing when i use loadtest request

To Reproduce

  1. git clone https://github.com/iaincollins/nextjs-starter

  2. cd nextjs-starter

  3. npm i

  4. add pm2.config.js file

      const pkg = require("./package.json");
    
      module.exports = {
           apps: [
               {
                    name: pkg.name,
                    script: "index.js",
                    instances: 1,
                    exec_mode: "cluster",
                    watch: false,
                    node_args: "--inspect --expose-gc",
                    max_memory_restart: "1500M",
                    env: {
                         NODE_ENV: "development",
                         BUILD_ENV: "test",
                         RUNTIME_ENV: "test",
                    },
                    env_test: {
                         NODE_ENV: "production",
                         BUILD_ENV: "test",
                         RUNTIME_ENV: "test",
                   },
              },
          ],
    };
    
  5. npm run build

  6. pm2 start pm2.config.js

  7. loadtest -c 30 --rps 20 http://localhost:80

  8. you can use pm2 monit or chrome://inspect See error
    I also use express test, it is ok!

system information

 OS: macOS
 Version of pm2: 4.2.1
 Version of loadtest: 4.1.0

Additional context

  use pm2 log see node inspect port

ad03283b-19e2-4928-a34c-e942a22162e3
8b6e20b7-6b9a-469d-bc9b-ccca6019f14e

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions