Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash calling cmake configure: JavaScript heap out of memory #2455

Closed
cesar14 opened this issue Mar 24, 2022 · 8 comments
Closed

Crash calling cmake configure: JavaScript heap out of memory #2455

cesar14 opened this issue Mar 24, 2022 · 8 comments
Labels
bug a bug in the product duplicate a duplicate of an already present issue more info needed More info is needed from the community for us to properly triage and investigate.

Comments

@cesar14
Copy link

cesar14 commented Mar 24, 2022

Brief Issue Summary

The extension is always crashing whenever I run the cmake configure command. I was not able to reproduce this behavior in other projects, seems to be just happening in this project that i've been working on (the project has a very large code base). The crash is only happening in cmake versions greater than v3.21.2 with version v3.20.1 i was not able to reproduce the crash.

CMake Tools Diagnostics

[main] Configuring folder: XXX
[main] Saving open files before configure/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[driver] Using compilers in Clang 10.0.1 x86_64-unknown-linux-gnu for configure
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /snap/bin/cmake with arguments ["--no-warn-unused-cli","-DCMAKE_EXPORT_COMPILE_COMMANDS=1","-DUSE_CCACHE=1","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=/home/XXX/.conan/data/llvm/10.0.1/XXX/stable/package/3827bec85b171f81c3a180cd2ca67e739b2cb48b/bin/clang-10","-S/opt/XXX/XXX/repositorio0/XXX_5_9","-B/opt/XXX/XXX/repositorio0/XXX/cmake_builds/debug","-G","Ninja"]
[proc] Executing command: /snap/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DUSE_CCACHE=1 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/home/XXX/.conan/data/llvm/10.0.1/XXX/stable/package/3827bec85b171f81c3a180cd2ca67e739b2cb48b/bin/clang-10 -S/opt/XXX/XXX/repositorio0/XXX -B/opt/XXX/XXX/repositorio0/XXX/cmake_builds/debug -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Current conanbuildinfo.cmake directory: /opt/XXX/XXX/repositorio0/XXX/cmake_builds/debug
[cmake] -- Conan: Compiler Clang>=8, checking major version 10.0
[cmake] -- Conan: Checking correct version: 10.0
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /opt/XXX/XXX/repositorio0/XXX_5_9/cmake_builds/debug
[cmakefileapi-parser] Read reply folder: /opt/XXX/XXX/repositorio0/XXX_5_9/cmake_builds/debug/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx]
[cache] Reading CMake cache file /opt/xxxx/XXX/repositorio0/XXX_5_9/cmake_builds/debug/CMakeCache.txt
[cache] Parsing CMake cache string

Debug Log

console.ts:137 [Extension Host] [CMakeTools] 2022-03-24T12:34:55.974Z [trace] [cache] Constructing a new cache entry from the given line
console.ts:137 [Extension Host] [CMakeTools] 2022-03-24T12:34:55.974Z [trace] [cache] Read line in cache with name=PACKAGE_LIBRARY_DEPS_/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5XmlPatterns.so.5.15.1, typename=INTERNAL, valuestr=/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Core.so;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Core.so.5;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Core.so.5.15;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Core.so.5.15.1;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Network.so;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Network.so.5;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Network.so.5.15;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5Network.so.5.15.1;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5NetworkAuth.so;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5NetworkAuth.so.5;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5NetworkAuth.so.5.15;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5NetworkAuth.so.5.15.1;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5XmlPatterns.so;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5XmlPatterns.so.5;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5XmlPatterns.so.5.15;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libQt5XmlPatterns.so.5.15.1;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libc++.so;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libc++.so.1;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libc++abi.so;/home/XXX/.conan/data/qt/5.15.1/XXX/stable/package/2549a15196ee398774eabe54b2986288e4a8952b/lib/libc++abi.so.1
console.ts:137 [Extension Host] [CMakeTools] 2022-03-24T12:34:55.974Z [trace] [cache] Constructing a new cache entry from the given line
localProcessExtensionHost.ts:294 Extension Host
localProcessExtensionHost.ts:295 Debugger attached.
log.ts:301  INFO UNRESPONSIVE extension host: starting to profile NOW
log.ts:307  WARN UNRESPONSIVE extension host: 'ms-vscode.cmake-tools' took 36% of 7623.294ms, saved PROFILE here: 'file:///tmp/exthost-f1704e.cpuprofile' (4) [{…}, {…}, {…}, {…}]
localProcessExtensionHost.ts:294 Extension Host
localProcessExtensionHost.ts:295 <--- Last few GCs --->[159093:0xa1600000000]   106424 ms: Scavenge 3830.5 (3964.8) -> 3830.4 (3964.8) MB, 280.8 / 0.0 ms  (average mu = 0.712, current mu = 0.694) allocation failure [159093:0xa1600000000]   106691 ms: Scavenge 3830.5 (3964.8) -> 3830.5 (3964.8) MB, 266.5 / 0.0 ms  (average mu = 0.712, current mu = 0.694) allocation failure [159093:0xa1600000000]   106951 ms: Scavenge 3830.5 (3964.8) -> 3830.5 (3964.8) MB, 260.2 / 0.0 ms  (average mu = 0.712, current mu = 0.694) allocation failure <--- JS stacktrace --->FATAL ERROR: Scavenger: semi-space copy Allocation failed - JavaScript heap out of memory
log.ts:313   ERR A system error occurred (read ECONNRESET): Error: read ECONNRESET
    at Pipe.onStreamRead (internal/stream_base_commons.js:209:20)
abstractExtensionService.ts:644 Extension host (LocalProcess) terminated unexpectedly. Code: null, Signal: SIGSEGV
_onExtensionHostCrashed @ abstractExtensionService.ts:644
_onExtensionHostCrashed @ extensionService.ts:256
_onExtensionHostCrashOrExit @ abstractExtensionService.ts:636
(anonymous) @ abstractExtensionService.ts:626
invoke @ event.ts:569
fire @ event.ts:736
_onExtHostProcessExit @ localProcessExtensionHost.ts:581
(anonymous) @ localProcessExtensionHost.ts:311
invoke @ event.ts:569
fire @ event.ts:736
G @ ipc.ts:632
onResponse @ ipc.ts:711
onBuffer @ ipc.ts:697
(anonymous) @ ipc.ts:509
invoke @ event.ts:569
fire @ event.ts:736
K @ event.ts:382
emit @ events.js:315
onMessage @ electron/js2c/renderer_init.js:105

exthost-f1704e.cpuprofile

exthost-f1704e_cpuprofile.log

Platform and Versions

**Operating System**: Ubuntu
**CMake Version**: cmake version 3.21.2
**VSCode Version**: 1.65.2
**CMake Tools Extension Version**: 1.10.5
**Compiler/Toolchain**: clang 10.0

Important note: this crash does not happen with cmake version 3.20.1

@riverwoodland
Copy link

I'm also having this same problem with cmake 3.21.2.

@bobbrow
Copy link
Member

bobbrow commented Mar 25, 2022

Does cmake work when you run the configure command outside of VS Code? If the differentiating factor is the version of CMake, it's possible that you would need Kitware to investigate this. You can open an issue for them here: https://gitlab.kitware.com/cmake/cmake/-/issues

@bobbrow bobbrow added bug a bug in the product more info needed More info is needed from the community for us to properly triage and investigate. upstream Bugs related to issues in an upstream project labels Mar 25, 2022
@cesar14
Copy link
Author

cesar14 commented Mar 25, 2022

yes, outside VS Code cmake works as expected no error or crash occurs.
The crash is only happening in cmake-tools vscode extension.

@bobbrow
Copy link
Member

bobbrow commented Mar 26, 2022

Are you able to share a project that reproduces this problem? We have not encountered this before. I still think this should be on Kitware to fix so a report on their repo would be the best path forward, but we can try to help isolate the problem as well if you share some details as to how you are hitting the problem. Are you using a VM, or physical machine? How much memory?

@cesar14
Copy link
Author

cesar14 commented Mar 28, 2022

sorry but I can not share the details of the project. As I mentioned before the cmake commands are working as expected outside vscode.
I am using physical machine with 64gb of RAM. Is there a way to configure the extension memory? the crash seems to be happening when the extension is not able to allocate more memory which is very strange because accordingly to the logs the extension memory is near of 4gb (+/-10% of all memory available)

@Worrador
Copy link

Having the same problem. Any resolution?

@bobbrow
Copy link
Member

bobbrow commented Aug 29, 2022

I think this might be related to #970 and #2586. Do you happen to have a large compile_commands.json file in your cmake cache folder?

@bobbrow bobbrow added duplicate a duplicate of an already present issue and removed upstream Bugs related to issues in an upstream project labels Aug 29, 2022
@github-actions
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product duplicate a duplicate of an already present issue more info needed More info is needed from the community for us to properly triage and investigate.
Projects
None yet
Development

No branches or pull requests

4 participants