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

High CPU usage with documentSymbols code #7022

Closed
sean-mcmanus opened this issue Feb 22, 2021 · 13 comments
Closed

High CPU usage with documentSymbols code #7022

sean-mcmanus opened this issue Feb 22, 2021 · 13 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@sean-mcmanus
Copy link
Collaborator

I noticed the fans were running on my MacBook, and I opened Activity Monitor to see that cpptools was using 98% CPU. I've had VS Code closed on my Mac since last night (when I opened approx 50 different cpp files), so I am not sure why cpptools would be running and using so much CPU right now.

Please let me know if there is a better place for me to report this bug, or if there are some logs I could collect and provide. I am running macOS Big Sur, and my C/C++ for VS Code is 1.2.2-insiders2.

Edit: I've also included photos of the stack trace, profiled using these instructions

image

image

Originally posted by @TylerADavis in #6238 (comment)

@sean-mcmanus sean-mcmanus added bug Language Service more info needed The issue report is not actionable in its current state not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). labels Feb 22, 2021
@sean-mcmanus
Copy link
Collaborator Author

It looks like there's some code in the particular file that is causing our document symbol code to potentially infinite loop. If you can provide some sample code that would enable us to debug/fix the issue.

@TylerADavis
Copy link
Contributor

Hi Sean, thanks for opening this. This may be a bit of an edge case, as this happened after grading 50 student assignments for coding style. I've included the full issue template below, please let me know if there is anything else that would be useful. Note that I only noticed high CPU ~12 hours after closing VS Code. I've run into this issue at least once before, but I don't recall if that was also after grading. My last google search for cpptools was the day after my last batch of grading though, so it's possibly related.

Type: LanguageService

Describe the bug

  • OS and Version: macOS Big Sur
  • VS Code Version: 11.2.1
  • C/C++ Extension Version: 1.2.2-insiders2
  • Other extensions you installed (and if the issue persists after disabling them):
  • Does this issue involve using SSH remote to run the extension on a remote machine?: No
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).: I noticed the fans were running on my MacBook, and I opened Activity Monitor to see that cpptools was using 98% CPU. I've had VS Code closed on my Mac since last night (when I opened approx 50 different cpp files), so I am not sure why cpptools would be running and using so much CPU right now.

Steps to reproduce

This is at least the second time I've encountered this issue, but I don't yet have exact repro steps.

  1. Open 50 separate .cpp files, each in their own folder, then quit VS Code. This weird workflow was from grading CS projects.
  2. Come back the next morning
  3. Use computer normally for ~1hr
  4. Notice fans are spinning up on laptop, open activity monitor, observe high CPU usage of cpptools

Expected behavior

I expect cpptools to not use high amounts of CPU while VS code is closed, especially if it has been closed for 12 hrs.

Logs
# Logs from C/C++ Log Diagnostics
-------- Diagnostics - 2/22/2021, 11:49:28 AM
Version: 1.2.2-insiders2
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "macFrameworkPath": [],
    "compilerPath": "/usr/local/bin/g++",
    "cStandard": "gnu11",
    "cppStandard": "gnu++98",
    "intelliSenseMode": "macos-gcc-x64",
    "compilerArgs": [],
    "intelliSenseModeIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "compilerPathIsExplicit": true,
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
No active translation units.

# Output from language server logging

File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
File exclude: **/.DS_Store
File exclude: **/.vscode
Search exclude: **/node_modules
Search exclude: **/bower_components
Search exclude: **/*.code-search
Search exclude: **/.vscode
Populate include completion cache.
Discovering files...
  Processing folder (recursive): /Library/Frameworks/digitizer.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/conveyor.framework/Versions/2.4.1/Headers/
  Processing folder (recursive): /Library/Frameworks/jsonrpc.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/thing.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/mbqtutils.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/mbcoreutils.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/R.framework/Versions/3.3/Resources/include/
  Processing folder (recursive): /Library/Frameworks/conveyor-ui.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/
  Processing folder (recursive): /Library/Frameworks/toolpathviz.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/Eigen.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /Library/Frameworks/IntelPowerGadget.framework/Versions/A/Headers/
  Processing folder (recursive): /Library/Frameworks/jsoncpp.framework/Versions/2.4.0/Headers/
  Processing folder (recursive): /usr/local/include/
Checking for syntax errors: file:///Users/tylerdavis/Documents/Grad%20School/Fourth%20Year/Winter%20Quarter/CS%2031/Grading/Project%204/Done/Project%204/array.cpp
sending compilation args for /Users/tylerdavis/Documents/Grad School/Fourth Year/Winter Quarter/CS 31/Grading/Project 4/Done/Project 4/array.cpp
  include: /usr/local/include/c++/5.2.0
  include: /usr/local/include/c++/5.2.0/x86_64-apple-darwin15.0.0
  include: /usr/local/include/c++/5.2.0/backward
  include: /usr/local/lib/gcc/x86_64-apple-darwin15.0.0/5.2.0/include
  include: /usr/local/include
  include: /usr/local/lib/gcc/x86_64-apple-darwin15.0.0/5.2.0/include-fixed
  include: /System/Library/Frameworks
  include: /Library/Frameworks
  define: __STDC__=1
  define: __cplusplus=199711L
  define: __STDC_HOSTED__=1
  define: __GNUC__=5
  define: __GNUC_MINOR__=2
  define: __GNUC_PATCHLEVEL__=0
  define: __VERSION__="5.2.0"
  define: __ATOMIC_RELAXED=0
  define: __ATOMIC_SEQ_CST=5
  define: __ATOMIC_ACQUIRE=2
  define: __ATOMIC_RELEASE=3
  define: __ATOMIC_ACQ_REL=4
  define: __ATOMIC_CONSUME=1
  define: __pic__=2
  define: __PIC__=2
  define: __FINITE_MATH_ONLY__=0
  define: _LP64=1
  define: __LP64__=1
  define: __SIZEOF_INT__=4
  define: __SIZEOF_LONG__=8
  define: __SIZEOF_LONG_LONG__=8
  define: __SIZEOF_SHORT__=2
  define: __SIZEOF_FLOAT__=4
  define: __SIZEOF_DOUBLE__=8
  define: __SIZEOF_LONG_DOUBLE__=16
  define: __SIZEOF_SIZE_T__=8
  define: __CHAR_BIT__=8
  define: __BIGGEST_ALIGNMENT__=16
  define: __ORDER_LITTLE_ENDIAN__=1234
  define: __ORDER_BIG_ENDIAN__=4321
  define: __ORDER_PDP_ENDIAN__=3412
  define: __BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__
  define: __FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__
  define: __SIZEOF_POINTER__=8
  define: __GNUG__=5
  define: __SIZE_TYPE__=long unsigned int
  define: __PTRDIFF_TYPE__=long int
  define: __WCHAR_TYPE__=int
  define: __WINT_TYPE__=int
  define: __INTMAX_TYPE__=long int
  define: __UINTMAX_TYPE__=long unsigned int
  define: __CHAR16_TYPE__=short unsigned int
  define: __CHAR32_TYPE__=unsigned int
  define: __SIG_ATOMIC_TYPE__=int
  define: __INT8_TYPE__=signed char
  define: __INT16_TYPE__=short int
  define: __INT32_TYPE__=int
  define: __INT64_TYPE__=long long int
  define: __UINT8_TYPE__=unsigned char
  define: __UINT16_TYPE__=short unsigned int
  define: __UINT32_TYPE__=unsigned int
  define: __UINT64_TYPE__=long long unsigned int
  define: __INT_LEAST8_TYPE__=signed char
  define: __INT_LEAST16_TYPE__=short int
  define: __INT_LEAST32_TYPE__=int
  define: __INT_LEAST64_TYPE__=long long int
  define: __UINT_LEAST8_TYPE__=unsigned char
  define: __UINT_LEAST16_TYPE__=short unsigned int
  define: __UINT_LEAST32_TYPE__=unsigned int
  define: __UINT_LEAST64_TYPE__=long long unsigned int
  define: __INT_FAST8_TYPE__=signed char
  define: __INT_FAST16_TYPE__=short int
  define: __INT_FAST32_TYPE__=int
  define: __INT_FAST64_TYPE__=long long int
  define: __UINT_FAST8_TYPE__=unsigned char
  define: __UINT_FAST16_TYPE__=short unsigned int
  define: __UINT_FAST32_TYPE__=unsigned int
  define: __UINT_FAST64_TYPE__=long long unsigned int
  define: __INTPTR_TYPE__=long int
  define: __UINTPTR_TYPE__=long unsigned int
  define: __GXX_WEAK__=1
  define: __DEPRECATED=1
  define: __GXX_RTTI=1
  define: __EXCEPTIONS=1
  define: __GXX_ABI_VERSION=1009
  define: __SCHAR_MAX__=0x7f
  define: __SHRT_MAX__=0x7fff
  define: __INT_MAX__=0x7fffffff
  define: __LONG_MAX__=0x7fffffffffffffffL
  define: __LONG_LONG_MAX__=0x7fffffffffffffffLL
  define: __WCHAR_MAX__=0x7fffffff
  define: __WCHAR_MIN__=(-__WCHAR_MAX__ - 1)
  define: __WINT_MAX__=0x7fffffff
  define: __WINT_MIN__=(-__WINT_MAX__ - 1)
  define: __PTRDIFF_MAX__=0x7fffffffffffffffL
  define: __SIZE_MAX__=0xffffffffffffffffUL
  define: __GLIBCXX_TYPE_INT_N_0=__int128
  define: __GLIBCXX_BITSIZE_INT_N_0=128
  define: __INTMAX_MAX__=0x7fffffffffffffffL
  define: __INTMAX_C(c)=c ## L
  define: __UINTMAX_MAX__=0xffffffffffffffffUL
  define: __UINTMAX_C(c)=c ## UL
  define: __SIG_ATOMIC_MAX__=0x7fffffff
  define: __SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)
  define: __INT8_MAX__=0x7f
  define: __INT16_MAX__=0x7fff
  define: __INT32_MAX__=0x7fffffff
  define: __INT64_MAX__=0x7fffffffffffffffLL
  define: __UINT8_MAX__=0xff
  define: __UINT16_MAX__=0xffff
  define: __UINT32_MAX__=0xffffffffU
  define: __UINT64_MAX__=0xffffffffffffffffULL
  define: __INT_LEAST8_MAX__=0x7f
  define: __INT8_C(c)=c
  define: __INT_LEAST16_MAX__=0x7fff
  define: __INT16_C(c)=c
  define: __INT_LEAST32_MAX__=0x7fffffff
  define: __INT32_C(c)=c
  define: __INT_LEAST64_MAX__=0x7fffffffffffffffLL
  define: __INT64_C(c)=c ## LL
  define: __UINT_LEAST8_MAX__=0xff
  define: __UINT8_C(c)=c
  define: __UINT_LEAST16_MAX__=0xffff
  define: __UINT16_C(c)=c
  define: __UINT_LEAST32_MAX__=0xffffffffU
  define: __UINT32_C(c)=c ## U
  define: __UINT_LEAST64_MAX__=0xffffffffffffffffULL
  define: __UINT64_C(c)=c ## ULL
  define: __INT_FAST8_MAX__=0x7f
  define: __INT_FAST16_MAX__=0x7fff
  define: __INT_FAST32_MAX__=0x7fffffff
  define: __INT_FAST64_MAX__=0x7fffffffffffffffLL
  define: __UINT_FAST8_MAX__=0xff
  define: __UINT_FAST16_MAX__=0xffff
  define: __UINT_FAST32_MAX__=0xffffffffU
  define: __UINT_FAST64_MAX__=0xffffffffffffffffULL
  define: __INTPTR_MAX__=0x7fffffffffffffffL
  define: __UINTPTR_MAX__=0xffffffffffffffffUL
  define: __GCC_IEC_559=2
  define: __GCC_IEC_559_COMPLEX=2
  define: __FLT_EVAL_METHOD__=0
  define: __DEC_EVAL_METHOD__=2
  define: __FLT_RADIX__=2
  define: __FLT_MANT_DIG__=24
  define: __FLT_DIG__=6
  define: __FLT_MIN_EXP__=(-125)
  define: __FLT_MIN_10_EXP__=(-37)
  define: __FLT_MAX_EXP__=128
  define: __FLT_MAX_10_EXP__=38
  define: __FLT_DECIMAL_DIG__=9
  define: __FLT_MAX__=3.40282346638528859812e+38F
  define: __FLT_MIN__=1.17549435082228750797e-38F
  define: __FLT_EPSILON__=1.19209289550781250000e-7F
  define: __FLT_DENORM_MIN__=1.40129846432481707092e-45F
  define: __FLT_HAS_DENORM__=1
  define: __FLT_HAS_INFINITY__=1
  define: __FLT_HAS_QUIET_NAN__=1
  define: __DBL_MANT_DIG__=53
  define: __DBL_DIG__=15
  define: __DBL_MIN_EXP__=(-1021)
  define: __DBL_MIN_10_EXP__=(-307)
  define: __DBL_MAX_EXP__=1024
  define: __DBL_MAX_10_EXP__=308
  define: __DBL_DECIMAL_DIG__=17
  define: __DBL_MAX__=double(1.79769313486231570815e+308L)
  define: __DBL_MIN__=double(2.22507385850720138309e-308L)
  define: __DBL_EPSILON__=double(2.22044604925031308085e-16L)
  define: __DBL_DENORM_MIN__=double(4.94065645841246544177e-324L)
  define: __DBL_HAS_DENORM__=1
  define: __DBL_HAS_INFINITY__=1
  define: __DBL_HAS_QUIET_NAN__=1
  define: __LDBL_MANT_DIG__=64
  define: __LDBL_DIG__=18
  define: __LDBL_MIN_EXP__=(-16381)
  define: __LDBL_MIN_10_EXP__=(-4931)
  define: __LDBL_MAX_EXP__=16384
  define: __LDBL_MAX_10_EXP__=4932
  define: __DECIMAL_DIG__=21
  define: __LDBL_MAX__=1.18973149535723176502e+4932L
  define: __LDBL_MIN__=3.36210314311209350626e-4932L
  define: __LDBL_EPSILON__=1.08420217248550443401e-19L
  define: __LDBL_DENORM_MIN__=3.64519953188247460253e-4951L
  define: __LDBL_HAS_DENORM__=1
  define: __LDBL_HAS_INFINITY__=1
  define: __LDBL_HAS_QUIET_NAN__=1
  define: __DEC32_MANT_DIG__=7
  define: __DEC32_MIN_EXP__=(-94)
  define: __DEC32_MAX_EXP__=97
  define: __DEC32_MIN__=1E-95DF
  define: __DEC32_MAX__=9.999999E96DF
  define: __DEC32_EPSILON__=1E-6DF
  define: __DEC32_SUBNORMAL_MIN__=0.000001E-95DF
  define: __DEC64_MANT_DIG__=16
  define: __DEC64_MIN_EXP__=(-382)
  define: __DEC64_MAX_EXP__=385
  define: __DEC64_MIN__=1E-383DD
  define: __DEC64_MAX__=9.999999999999999E384DD
  define: __DEC64_EPSILON__=1E-15DD
  define: __DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD
  define: __DEC128_MANT_DIG__=34
  define: __DEC128_MIN_EXP__=(-6142)
  define: __DEC128_MAX_EXP__=6145
  define: __DEC128_MIN__=1E-6143DL
  define: __DEC128_MAX__=9.999999999999999999999999999999999E6144DL
  define: __DEC128_EPSILON__=1E-33DL
  define: __DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL
  define: __REGISTER_PREFIX__=
  define: __USER_LABEL_PREFIX__=_
  define: __GNUC_GNU_INLINE__=1
  define: __NO_INLINE__=1
  define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1
  define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1
  define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1
  define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1
  define: __GCC_ATOMIC_BOOL_LOCK_FREE=2
  define: __GCC_ATOMIC_CHAR_LOCK_FREE=2
  define: __GCC_ATOMIC_CHAR16_T_LOCK_FREE=2
  define: __GCC_ATOMIC_CHAR32_T_LOCK_FREE=2
  define: __GCC_ATOMIC_WCHAR_T_LOCK_FREE=2
  define: __GCC_ATOMIC_SHORT_LOCK_FREE=2
  define: __GCC_ATOMIC_INT_LOCK_FREE=2
  define: __GCC_ATOMIC_LONG_LOCK_FREE=2
  define: __GCC_ATOMIC_LLONG_LOCK_FREE=2
  define: __GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1
  define: __GCC_ATOMIC_POINTER_LOCK_FREE=2
  define: __PRAGMA_REDEFINE_EXTNAME=1
  define: __SIZEOF_INT128__=16
  define: __SIZEOF_WCHAR_T__=4
  define: __SIZEOF_WINT_T__=4
  define: __SIZEOF_PTRDIFF_T__=8
  define: __amd64=1
  define: __amd64__=1
  define: __x86_64=1
  define: __x86_64__=1
  define: __SIZEOF_FLOAT80__=16
  define: __SIZEOF_FLOAT128__=16
  define: __ATOMIC_HLE_ACQUIRE=65536
  define: __ATOMIC_HLE_RELEASE=131072
  define: __k8=1
  define: __k8__=1
  define: __tune_core2__=1
  define: __code_model_small__=1
  define: __MMX__=1
  define: __SSE__=1
  define: __SSE2__=1
  define: __SSE3__=1
  define: __FXSR__=1
  define: __SSE_MATH__=1
  define: __SSE2_MATH__=1
  define: __LITTLE_ENDIAN__=1
  define: __MACH__=1
  define: __APPLE__=1
  define: __APPLE_CC__=1
  define: __CONSTANT_CFSTRINGS__=1
  define: __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=101600
  define: __strong=
  define: __weak=
  define: __DYNAMIC__=1
  other: --g++
  other: --gnu_version=50200
  Processing folder (recursive): /usr/local/lib/gcc/x86_64-apple-darwin15.0.0/5.2.0/include/
  Processing folder (recursive): /usr/local/lib/gcc/x86_64-apple-darwin15.0.0/5.2.0/include-fixed/
  Discovering files: 25776 file(s) processed
  0 file(s) removed from database
Done discovering files.
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
Queueing IntelliSense update for files in translation unit of: /Users/tylerdavis/Documents/Grad School/Fourth Year/Winter Quarter/CS 31/Grading/Project 4/Done/Project 4/array.cpp
Error squiggle count: 10
Error squiggles will be disabled in: file:///Users/tylerdavis/Documents/Grad%20School/Fourth%20Year/Winter%20Quarter/CS%2031/Grading/Project%204/Done/Project%204/array.cpp
Update IntelliSense time (sec): 9.526
idle loop: reparsing the active document
Checking for syntax errors: file:///Users/tylerdavis/Documents/Grad%20School/Fourth%20Year/Winter%20Quarter/CS%2031/Grading/Project%204/Done/Project%204/array.cpp
Queueing IntelliSense update for files in translation unit of: /Users/tylerdavis/Documents/Grad School/Fourth Year/Winter Quarter/CS 31/Grading/Project 4/Done/Project 4/array.cpp
Error squiggle count: 10
Update IntelliSense time (sec): 0.26
idle loop: reparsing the active document
Checking for syntax errors: file:///Users/tylerdavis/Documents/Grad%20School/Fourth%20Year/Winter%20Quarter/CS%2031/Grading/Project%204/Done/Project%204/array.cpp
Queueing IntelliSense update for files in translation unit of: /Users/tylerdavis/Documents/Grad School/Fourth Year/Winter Quarter/CS 31/Grading/Project 4/Done/Project 4/array.cpp
Error squiggle count: 10
Update IntelliSense time (sec): 0.263


Screenshots

Additional context

@TylerADavis
Copy link
Contributor

As for a code snippet, since this was after grading ~50 student assignments, I'm not sure if this is perhaps due to one particular .cpp file that was submitted, or if it is perhaps due to rapidly opening many copies of identically named cpp files that all contain identically named functions.

I've included an image below showing the general layout of the files at the time I opened them. Would it still be helpful to see a code sample to get an idea of how the submissions look?

image

@sean-mcmanus
Copy link
Collaborator Author

sean-mcmanus commented Feb 22, 2021

The issue is most likely triggered by code in a particular file and not by rapidly opening many different files. Are you able to locate the file that is triggering the issue? You would likely see the Outline view fail to be populated. If you set C_Cpp.loggingLevel to "Debug", then the C/C++ output pane should show something like
cpptools/getDocumentSymbols: <file> and the last message would most likely show which file is causing the issue.

@sean-mcmanus
Copy link
Collaborator Author

sean-mcmanus commented Feb 22, 2021

The code that exists at a non-local scope is the most likely to be the cause, so function definitions/bodies are unlikely to be needed for the repro.

@TylerADavis
Copy link
Contributor

Here is a gist containing the debug logs: https://gist.github.com/TylerADavis/b62ec12b45bf0ee7dad652a4b61509a1

The debug logs appear to be specific to the file I have open at the moment I open the output pane, is there a way to get logs for all open files / just get logs from the instance of cpptools that is stuck in a loop? Or would I need to manually open each submission and see which one is hanging / not populating the outline view?

@sean-mcmanus
Copy link
Collaborator Author

There should be one cpptools process per VS Code instance...assuming you're not seeing a dangling one from a previous instance then most likely the cpptools process belongs to the VS Code instance that is currently open. You should be able to close the VS Code instance and reopen that same file to retrigger the repro, right?

I found a repro of an infinite loop using

namespace foo::foo::foo::foo
{
	int i;
}

which I reported at #7025, but I'm guessing your repro is probably different and I'm not sure yet if they share the same root cause.

@TylerADavis
Copy link
Contributor

Ah, this looping one must be dangling from a previous VS Code instance then. I hadn't realized that cpptools is supposed to shut down with VS Code, and activity monitor does show two instances of cpptools. I'll reopen all files and see if that can get the properly behaving cpptools currently idle at 0% CPU to get stuck at 100%.

image

@TylerADavis
Copy link
Contributor

TylerADavis commented Feb 22, 2021

I've reopened all the files I could think of that might have triggered this loop, but I didn't have any success getting another cpptools process looping. Do you have any other recommendations for how I might find out what got the looping process (I still haven't killed it) stuck? Also, is it possible that deleting a file from disk while analysis is incomplete could cause this issue? I also wonder if it is necessary to quit VS Code or wait a certain time period in order to trigger this bug (I'm not too familiar with how cpptools and the language server are architected, so I'm not sure what's reasonable). I'm assuming there is a way to consistently repro this, but it seems simply opening the files isn't sufficient (assuming one of the student submissions was the culprit).

Workflow while grading:

  • Unzip folder
  • Open cpp file in VS code
  • Scroll through file
  • Occasionally accidentally type grading comments into the cpp files directly, e.g. #include <string>-1 some functions lacking documentation
  • Unzip another folder
  • Occasionally close VS Code windows to remove unneeded tabs
  • Occasionally delete unzipped assignments from disk (both .cpp file and enclosing folder)
  • Finish grading
  • Close VS Code
  • Notice high CPU usage and ~10 hrs of CPU time on cpptools the next morning

Flow when attempting to reproduce:

cd project4/Tyler # Same flow for project3
# Unzip all project files in Finder
# Open all cpp files in VS code
code ./*/*.cpp

At this point a VS code window opens with ~50 tabs. I look at each tab one by one, waiting until the outline view populates and the files are scanned for errors. I observe that all outline views successfully populate, and all files are scanned for errors.

This image shows the stuck cpptools from last night, as well as two new cpptoolsprocesses. I believe these two cpptools processes correspond to the two open VS Code windows I have.
image

@sean-mcmanus
Copy link
Collaborator Author

It's possible one of the edits you made to the code could have triggered the bug. The call stack provided shows that it's stuck processing the symbols for the currently opened file. The code operates on the database file that is obtained from parsing the files. So it's possible the database was in some bad state. Since #7025 is a regression with 1.2.2-insiders(2) and that's what you were using, it's possible they share the same root cause (although it's also possible your issue would repro with 1.2.1).

I've also filed bug #7026 in regards to cpptools not shutting down (only seems to occur on Mac).

@TylerADavis
Copy link
Contributor

Great, thank you for all of your help! I'll follow up on this issue if I'm able to reproduce this issue, either through regular use or when grading.

If it helps, my last google search for cpptools was on Feb 7th, which seems to be after 1.2.0 was cut, though I'm not sure which build of the extension I would have been running, or if that search was because I was encountering the same issue.

@sean-mcmanus
Copy link
Collaborator Author

We got another repro at #7012 which is more of a real world scenario that repros only on Linux/Mac for some unusual reason. Might still share the same root cause.

@sean-mcmanus sean-mcmanus removed more info needed The issue report is not actionable in its current state not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). labels Feb 24, 2021
@sean-mcmanus sean-mcmanus added this to the 1.2.2 milestone Feb 24, 2021
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Feb 24, 2021
@sean-mcmanus
Copy link
Collaborator Author

@TylerADavis Should be fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.2.2 .

You may notice a bugs with the Outline view with nested symbols -- we plan to fix that for 1.3: #6830

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants