Memory leak on typescript with multiple projects (3)

  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud
  • Scanner command used when applicable (private details masked)
        - pipe: sonarsource/sonarcloud-scan:1.0.1
          variables:
            SONAR_TOKEN: ${SONAR_TOKEN}
            EXTRA_ARGS: '
              -Dsonar.sources=packages/nestjs-auth/src,packages/webapp-middleware/src
              -Dsonar.tests=packages/jwt-utils/test,packages/nestjs-auth/test,packages/webapp-middleware/test
              -Dsonar.test.inclusions="*{.,-}spec.ts"
              -Dsonar.log.level=DEBUG
              -Dsonar.coverage.exclusions="**/node_modules/**,**/test/**,**/dist/**"
              -Dsonar.javascript.lcov.reportPaths=packages/jwt-utils/coverage/lcov.info,packages/nestjs-auth/coverage/lcov.info,packages/webapp-middleware/coverage/lcov.info'
  • Languages of the repository: typescript

  • Error observed:

15:26:32.855 INFO: 31 source files to be analyzed
15:26:32.856 INFO: Analyzing 10 files using tsconfig: /opt/atlassian/pipelines/agent/build/packages/webapp-middleware/tsconfig.json
15:26:32.861 DEBUG: 'packages/webapp-middleware/src/types/index.d.ts' generated metadata with charset 'UTF-8'
15:26:35.214 DEBUG: Not enough content in 'packages/webapp-middleware/src/types/index.d.ts' to have CPD blocks, it will not be part of the duplication detection
15:26:35.327 DEBUG: Not enough content in 'packages/webapp-middleware/src/index.ts' to have CPD blocks, it will not be part of the duplication detection
15:26:35.858 DEBUG: Not enough content in 'packages/webapp-middleware/src/errors/httpError.ts' to have CPD blocks, it will not be part of the duplication detection
15:26:35.902 DEBUG: Not enough content in 'packages/webapp-middleware/src/errors/index.ts' to have CPD blocks, it will not be part of the duplication detection
15:26:36.105 INFO: Analyzing 15 files using tsconfig: /opt/atlassian/pipelines/agent/build/packages/nestjs-auth/tsconfig.json
15:26:45.773 INFO: 10/31 files analyzed, current file: packages/nestjs-auth/src/authenticate/context/rest-strategy.ts
15:26:56.658 INFO: 10/31 files analyzed, current file: packages/nestjs-auth/src/authenticate/context/rest-strategy.ts
15:27:07.330 INFO: 10/31 files analyzed, current file: packages/nestjs-auth/src/authenticate/context/rest-strategy.ts
15:27:17.946 INFO: 10/31 files analyzed, current file: packages/nestjs-auth/src/authenticate/context/rest-strategy.ts
15:27:18.237 DEBUG: 'packages/nestjs-auth/src/authenticate/context/authenticated-context.ts' generated metadata with charset 'UTF-8'
15:27:18.268 DEBUG: Not enough content in 'packages/nestjs-auth/src/authenticate/context/authenticated-context.ts' to have CPD blocks, it will not be part of the duplication detection
15:27:18.364 DEBUG: 'packages/nestjs-auth/src/auth.d.ts' generated metadata with charset 'UTF-8'
15:27:18.414 DEBUG: Not enough content in 'packages/nestjs-auth/src/auth.d.ts' to have CPD blocks, it will not be part of the duplication detection
15:27:18.534 DEBUG: 'packages/nestjs-auth/src/index.ts' generated metadata with charset 'UTF-8'
15:27:18.572 DEBUG: Not enough content in 'packages/nestjs-auth/src/index.ts' to have CPD blocks, it will not be part of the duplication detection
15:27:18.693 DEBUG: Not enough content in 'packages/nestjs-auth/src/request-type.enum.ts' to have CPD blocks, it will not be part of the duplication detection
15:27:20.510 DEBUG: 'packages/nestjs-auth/src/authenticate/context/authenticated-context-strategy.ts' generated metadata with charset 'UTF-8'
15:27:20.871 DEBUG: Not enough content in 'packages/nestjs-auth/src/authenticate/context/authenticated-context-strategy.ts' to have CPD blocks, it will not be part of the duplication detection
15:27:21.059 INFO: Analyzing 6 files using tsconfig: /opt/atlassian/pipelines/agent/build/packages/jwt-utils/tsconfig.json
time="2020-06-18T15:27:22Z" level=error msg="error waiting for container: unexpected EOF"

The project have a root folder and 3 projects on it. It is a “core” project, and one wrapper to nestjs and another to express middleware. Each one of them has its own tsconfig and packages files.
If I choose only 2 of the projects to analyses, everything works fast and without problems. But if I choose to analyses 3 projects then I have the problem.
Choosing any combination of 2 projects I can run with size 1x (4GB), but choosing 3 I can’t run on size 2x (8GB).
The project is very small to need so much memory (31 small files on total). I did some tests:

Failed (size: 2x, sources: 3, files: 31, time: 8m 56s):
-Dsonar.sources=packages/jwt-utils/src,packages/nestjs-auth/src,packages/webapp-middleware/src

Sucesso (size: 1x, sources: 2, files: 21, time: 1m 25s):
-Dsonar.sources=packages/jwt-utils/src,packages/nestjs-auth/src

Sucesso (size: 1x, sources: 2, files: 16, time: 2m 26s):
-Dsonar.sources=packages/jwt-utils/src,packages/webapp-middleware/src

Sucesso (size: 1x, sources: 2, files: 25, time: 1m 30s)
-Dsonar.sources=packages/nestjs-auth/src,packages/webapp-middleware/src

I believe I can share more data privately (source/config). Any help are welcome.

hello @Leo_Loft,

can you to set option sonar.javascript.node.maxspace=7168 on 8GB node to see if it helps? I’ve also sent you a private message where you can share your project with us to investigate.