microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.45k stars 1.53k forks source link

SQLite crash/corruption when database is on a remote filesystem #1603

Open draeger-charles-wilson opened 6 years ago

draeger-charles-wilson commented 6 years ago

I've just updated to 1.20.1 / 0.15.0 and foolishly deleted the previously working versions whose numbers I do not recall (late December updates). The auto update of the cpptools extension failed to be able to download its bits and so I installed it from the (self-contained) VSIX file. Unfortunately, the extension seems possessed to make a JSON RPC call which fails. The result being no Intellisense information and no compilation capability.

OS: Windows 7 cpptools 0.15.0 Version 1.20.1 Commit f88bbf9137d24d36d968ea6b2911786bfe103002 Date 2018-02-13T15:34:36.336Z Shell 1.7.9 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64

steps: open C file

[Error - 1:28:13 PM] Request textDocument/codeAction failed. Error: Connection got disposed. at Object.dispose (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-jsonrpc\lib\main.js:825:25) at Object.dispose (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-languageclient\lib\client.js:57:35) at LanguageClient.handleConnectionClosed (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-languageclient\lib\client.js:1864:38) at LanguageClient.handleConnectionClosed (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-languageclient\lib\main.js:78:15) at closeHandler (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-languageclient\lib\client.js:1852:18) at CallbackList.invoke (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-jsonrpc\lib\events.js:71:39) at Emitter.fire (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-jsonrpc\lib\events.js:135:36) at closeHandler (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-jsonrpc\lib\main.js:221:26) at CallbackList.invoke (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-jsonrpc\lib\events.js:71:39) at Emitter.fire (C:\Users\wilson.vscode\extensions\ms-vscode.cpptools-0.15.0\node_modules\vscode-jsonrpc\lib\events.js:135:36) [Error - 1:28:13 PM] Connection to server got closed. Server will not be restarted.

bobbrow commented 6 years ago

We have self-contained downloadable versions available here: https://github.com/Microsoft/vscode-cpptools/releases

draeger-charles-wilson commented 6 years ago

As stated in the problem, I downloaded the self-contained VSIX version of the extension.

bobbrow commented 6 years ago

Ok. I read the and here to mean that you were still talking about the VSIX that failed.

The auto update of the cpptools extension failed to be able to download its bits and I installed it from the VSIX file

In that case, it looks like the extension is crashing. Can you add "C_Cpp.loggingLevel": "Information" to your settings.json and then restart VSCode? Then paste any logging messages you see in the Output window for the "C/C++" channel here. In the meantime, I'll take a look at the codeAction event handler to see if anything stands out.

draeger-charles-wilson commented 6 years ago

Did that, and the output is provided. I put the logging level setting in my user setting file.

bobbrow commented 6 years ago

Where did you provide the output? The messages you pasted at the beginning of this issue are not from the "C/C++" Output channel.

draeger-charles-wilson commented 6 years ago

The error provided was from the output window. Snip now attached. vscode c error

sean-mcmanus commented 6 years ago

@draeger-charles-wilson That is not the C/C++ output channel.

draeger-charles-wilson commented 6 years ago

My mistake. How do I access the C/C++ output channel?

bobbrow commented 6 years ago

It's in the drop down box to the right of the tabs (where "cpptools: PMA" is in your screenshot). If you're using a multi-root workspace it will be "C/C++: PMA", otherwise it should just be called "C/C++".

draeger-charles-wilson commented 6 years ago

Not seeing it.

drop_down

Note: I restarted and it attempted to load the language server 5 times. Apparently yielding the 5 entries in the menu.

no_reload

sean-mcmanus commented 6 years ago

It looks like our language service process is crashing 5 times and causing the extension to not be loadable. I don't know what could be causing this. I'm not aware of any widespread crashing on Windows (0.15.0 fixed our previous high hitting Windows crashes). Maybe it's some issue with Win7? Did you install the 0.15.0 vsix or an older one?

draeger-charles-wilson commented 6 years ago

I have uninstalled and reinstalled from the current bits. Is it trying to phone home for something? We have a very aggressive firewall. Could this be a telemetry issue? I'd submitted an issue previously where the default for telemetry was set to not send by default for similar reasons.

sean-mcmanus commented 6 years ago

I don't think telemetry code can be causing any issues -- you can disable telemetry via setting telemetry.enableTelemetry to "false".

bobbrow commented 6 years ago

JSON RPC is for inter-process communication, not telemetry. You might want to try attaching to the extension process on launch and then sending us a callstack. There is a good article on setting up WinDbg to attach on process launch. The process you want to attach to is Microsoft.VSCode.CPP.Extension.exe.

draeger-charles-wilson commented 6 years ago

I've not used WinDbg myself and while I was able to get it to stop on launch of the extension, continuing execution merely saw that process sit. If I dismissed WinDbg itself, this was repeated 4 more times and then the final error message would appear.

I took another look at my c_cpp_properties.json and discovered that one of my mounted volumes referenced in the 'includePath' section was no longer on-line. When I switch the path to a volume that was present, the error still occurred, but the C/C++ log appeared in the output dropdown.

c_c _in_dropdown

The contents of that window is:

IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
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: **/.vscode
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
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: **/.vscode
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
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: **/.vscode
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
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: **/.vscode
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
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: **/.vscode

So, this appears to be one bug. I'm going to continue tinkering with the properties file for a bit.

bobbrow commented 6 years ago

Yeah, the extension should only print out those initial lines when you make a change to your VSCode settings (or when the extension first launches) so it's definitely crashing somewhere.

I'm surprised that WinDbg didn't break in when the extension crashed. You may need to tell it to break on first chance exceptions (from the menu: Debug -> Event Filters... -> select "C++ EH exception" and enable it). That information about having an offline drive is helpful though. I'll see if I can reproduce the error for that case.

If you have Visual Studio installed and are more familiar with debugging in that environment, you can point gflags to c:\windows\system32\vsjitdebugger.exe instead of WinDbg.exe.

draeger-charles-wilson commented 6 years ago

Side note: The c_cpp_properties.json updates the version from 2 to 3. The current documentation describes version 2. Is there an update describing what the differences are?

draeger-charles-wilson commented 6 years ago

I was able to catch the exception in VS2017

Exception:

Unhandled exception at 0x00E66407 in Microsoft.VSCode.CPP.Extension.exe: 0xC0000006: In page error reading location 0x00150000 (status code 0xC0000054). Registers:

EAX = 0069A478 EBX = 00150000 ECX = 0000000C EDX = 006AA598 ESI = 00150000 EDI = 046BE8A0 EIP = 00E66407 ESP = 046BE850 EBP = 046BE8D4 EFL = 00010282

Threads:

Not Flagged     0x000032A0  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000000FC  0x00    Main Thread Main Thread Microsoft.VSCode.CPP.Extension.exe!011fce6c
Not Flagged     0x00003288  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002B5C  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002A90  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000006A8  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002098  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000012E8  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002A94  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000029B4  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002898  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000012F0  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00001CA0  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x0000312C  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000014A4  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002AA0  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00001CA4  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000006FC  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000028F4  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000006C8  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000024C8  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00001DBC  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x000030C4  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00003264  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged     0x00002CC8  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!0112ffe6
Not Flagged >   0x000014E4  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!00e66407
Not Flagged     0x000030D0  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!01152fcc
Not Flagged     0x000015C0  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!01152fcc
Not Flagged     0x000020D8  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!01152fcc
Not Flagged     0x00002B98  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!01152fcc
Not Flagged     0x00002ADC  0x00    Worker Thread   Microsoft.VSCode.CPP.Extension.exe thread   Microsoft.VSCode.CPP.Extension.exe!01152fcc

Call Stack:

>   Microsoft.VSCode.CPP.Extension.exe!00e66407()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for Microsoft.VSCode.CPP.Extension.exe]    
    Microsoft.VSCode.CPP.Extension.exe!00e65eba()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e46a80()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e6ec2d()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e463bc()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e4a778()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e49185()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e435ce()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00e10976()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00df84b4()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00dec110()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00df7f9a()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!01152ec8()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!0114d0db()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00de93f1()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00df4477()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00de9f4c()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00de9e44()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00dcb69d()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d9e86a()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d93a8e()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d94d4c()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d9dc46()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d89345()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!0114d28b()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d4a3d1()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!00d4a072()   Unknown
    Microsoft.VSCode.CPP.Extension.exe!011cbf85()   Unknown
    [External Code] 

Disassembly:

00E663F0  mov         eax,dword ptr [ebp+0Ch]  
00E663F3  push        ebx  
00E663F4  push        esi  
00E663F5  push        edi  
00E663F6  mov         dword ptr [ebp-6Ch],eax  
00E663F9  lea         edi,[ebp-34h]  
00E663FC  mov         eax,dword ptr [edx+20h]  
00E663FF  push        0Ch  
00E66401  pop         ecx  
00E66402  push        edx  
00E66403  mov         ebx,dword ptr [eax]  
00E66405  mov         esi,ebx  
00E66407  rep movs    dword ptr es:[edi],dword ptr [esi]  
00E66409  mov         dword ptr [ebp-68h],edx  
00E6640C  call        00E66D22  
00E66411  pop         ecx  
00E66412  push        0Ch  
00E66414  lea         esi,[ebx+30h]  
00E66417  pop         ecx  
00E66418  lea         edi,[ebp-64h]  
00E6641B  rep movs    dword ptr es:[edi],dword ptr [esi]  
00E6641D  xor         esi,esi  
00E6641F  lea         edx,[ebp-34h]  
00E66422  lea         edi,[ebp-64h]  
00E66425  mov         ecx,esi  
00E66427  mov         eax,dword ptr [edx+ecx*4]  
00E6642A  cmp         eax,dword ptr [edi+ecx*4]  
00E6642D  jne         00E664A6  
00E6642F  inc         ecx  

Parallel Stacks:

parallel_stacks

bobbrow commented 6 years ago

version 3 adds the "macFrameworkPath" property (which should be essentially a no-op upgrade for your config)

bobbrow commented 6 years ago

Were you able to get a callstack at the crash site?

bobbrow commented 6 years ago

Hmm... the symbols weren't resolved. @sean-mcmanus we published symbols for this, right?

@draeger-charles-wilson, in Visual Studio could you do "Debug" -> "Save Dump As..." and then email the crash dump to us so we can debug it? That would be super helpful. c_cpp_support@microsoft.com

draeger-charles-wilson commented 6 years ago

Will do. Any subject line recommendations?

Emailed as subject: 'cpptools-0.15.0 fails while attempting JSON RPC call #1603'

bobbrow commented 6 years ago

Thanks. Unfortunately, I was unable to open that dmp file in any of my debuggers. ☹️ It's possible that our email scanner strips out information from zipped files, or it could be related to the error you mentioned. Are you able to open it in Visual Studio on your PC?

draeger-charles-wilson commented 6 years ago

Looks corrupted on this end. Let me switch VS instances. Hopefully the dump will complete.

draeger-charles-wilson commented 6 years ago

Neither VS2017 preview or VS2017 (current) would save the dump correctly. I had to fall back to VS2015 to get a valid dump file. Sending now.

draeger-charles-wilson commented 6 years ago

My capture in VS2015 was at the initial entry. My bad.

The debugger doesn't appear to be able to create a dump file if I attempt to capture the heap also.

It does work if I leave off the heap. Once more down to the beach dear friends.

sean-mcmanus commented 6 years ago

We publish symbols -- I'm able to get them internally via https://symweb. I don't know how that translates into external users getting the symbols.

Just the call stack text without the heap should be okay.

sean-mcmanus commented 6 years ago

Oh, it's a crash deep inside SQLITE3 when we try to create the browse database. Are you able to change your browse.databaseFilename to a valid location? It might have some problem creating the database files at the default workspace storage location. Or it could be a SQLITE3 bug? I haven't seen any other crashes like this before, so it seems like some rare special case.

Do you have multiple VS Code instances open (or multiple root folders) that open the same folder? If 2 extensions processes are trying to create a connection to the same database that could cause a failure (although it's supposed to fail gracefully and not crash, so this could be a different issue)...and we attempt to detect this and create a new database if it's in use though.

Microsoft.VSCode.CPP.Extension.exe!walIndexTryHdr(Wal * pWal=0x003fb460, int * pChanged=0x04ece9c8) Line 56503  C
Microsoft.VSCode.CPP.Extension.exe!walIndexReadHdr(Wal * pWal=0x003fb460, int * pChanged=0x04ece9c8) Line 56577 C
Microsoft.VSCode.CPP.Extension.exe!walTryBeginRead(Wal * pWal=0x003fb460, int * pChanged=0x04ece9c8, int useWal=0, int cnt=1) Line 56697    C
Microsoft.VSCode.CPP.Extension.exe!pagerBeginReadTransaction(Pager * pPager=0x003fa118) Line 50138  C
Microsoft.VSCode.CPP.Extension.exe!sqlite3PagerSharedLock(Pager * pPager=0x003fa118) Line 52225 C
Microsoft.VSCode.CPP.Extension.exe!lockBtree(BtShared * pBt=0x003cb518) Line 61943  C
Microsoft.VSCode.CPP.Extension.exe!sqlite3BtreeBeginTrans(Btree * p=0x003f8160, int wrflag=0) Line 62308    C
Microsoft.VSCode.CPP.Extension.exe!sqlite3InitOne(sqlite3 * db=0x003f9300, int iDb=0, char * * pzErrMsg=0x04ecf2b8) Line 115854 C
Microsoft.VSCode.CPP.Extension.exe!sqlite3Init(sqlite3 * db=0x003f9300, char * * pzErrMsg=0x04ecf2b8) Line 116033   C
Microsoft.VSCode.CPP.Extension.exe!sqlite3ReadSchema(Parse * pParse=0x04ecf2b4) Line 116070 C
Microsoft.VSCode.CPP.Extension.exe!sqlite3Pragma(Parse * pParse=0x04ecf2b4, Token * pId1=0x04ecec64, Token * pId2=0x04ecec74, Token * pValue=0x04ecec94, int minusFlag=0) Line 113650   C
Microsoft.VSCode.CPP.Extension.exe!yy_reduce(yyParser * yypParser=0x04ecec28, unsigned int yyruleno=220) Line 138647    C
Microsoft.VSCode.CPP.Extension.exe!sqlite3Parser(void * yyp=0x04ecec28, int yymajor=1, Token yyminor={...}, Parse * pParse=0x04ecf2b4) Line 139056  C
Microsoft.VSCode.CPP.Extension.exe!sqlite3RunParser(Parse * pParse=0x04ecf2b4, const char * zSql=0x017bf1d7, char * * pzErrMsg=0x04ecf2a4) Line 140012  C
Microsoft.VSCode.CPP.Extension.exe!sqlite3Prepare(sqlite3 * db=0x003f9300, const char * zSql=0x017bf1c4, int nBytes=-1, int saveSqlFlag=1, Vdbe * pReprepare=0x00000000, sqlite3_stmt * * ppStmt=0x04ecf548, const char * * pzTail=0x04ecf520) Line 116258  C
Microsoft.VSCode.CPP.Extension.exe!sqlite3LockAndPrepare(sqlite3 * db=0x003f9300, const char * zSql=0x017bf1c4, int nBytes=-1, int saveSqlFlag=1, Vdbe * pOld=0x00000000, sqlite3_stmt * * ppStmt=0x04ecf548, const char * * pzTail=0x04ecf520) Line 116349 C
Microsoft.VSCode.CPP.Extension.exe!sqlite3_prepare_v2(sqlite3 * db=0x003f9300, const char * zSql=0x017bf1c4, int nBytes=-1, sqlite3_stmt * * ppStmt=0x04ecf548, const char * * pzTail=0x04ecf520) Line 116425   C
bobbrow commented 6 years ago

We do have code that checks the path is valid before we attempt to open the DB, so my theory is that the database is readable, but corrupted and needs to be reset. Changing the "browse.databaseFilename" for the active config in your c_cpp_properties.json file will work around the problem, but you'll probably want to delete the old database too. Please let us know whether you set "browse.databaseFilename" in your c_cpp_properties.json to a path that you expect to be writable or not so we can determine what the actual defect is here. If you left that setting empty, we would also want to know.

Thanks for the crash dump!

sean-mcmanus commented 6 years ago

Yeah, if the database is somehow corrupt you could do a Reset IntelliSense Database command.

bobbrow commented 6 years ago

That command won't work if the extension crashes on launch. You'll need to manually remove it.

sean-mcmanus commented 6 years ago

Ah, yeah :). The default location is under %APPDATA%\Code\User\workspaceStorage.

draeger-charles-wilson commented 6 years ago

The database file location, which was working until this update, has been set in the c_cpp_properties.json file.

"databaseFilename": "${workspaceRoot}/.vscode/browse.vc.db"

I've tried deleting the database files and the result is the same.

draeger-charles-wilson commented 6 years ago

@sean-mcmanus I only have the one instance of Code open. As indicated in the above comment, the database location is workspace-relative.

draeger-charles-wilson commented 6 years ago

If I make the database location somewhere outside the workspace the error does not manifest. This isn't really a good solution as the database really should be with the workspace.

Please note that the path I've been using is the one provided in the documentation. (which doesn't indicate what the defaults are)

draeger-charles-wilson commented 6 years ago

Assuming that you can't make the workspace-relative path work, shouldn't there be two settings here:


"databasePath": "${workspaceRoot}/.vscode"
"databaseFilename": "browse.vc.db"

This would allow for better control over use, as either one could be defaulted.

sean-mcmanus commented 6 years ago

That is very strange. Workspace-relative database paths are working for me (and others) and I don't know a reason why they would not -- we just replace the ${workspaceRoot} variable with the folder path. Does it work if you replace the ${workspaceRoot} with the actual path? Does it work if the database path is in a sibling or parent folder or does it need to be on a different drive? The crash appears to be when SQLITE is trying to read the temporary wal files that get written next to the database, so if some external process is interfering with the wal file that could cause the crash (i.e. a virus scanner might be quarantining the file incorrectly).

draeger-charles-wilson commented 6 years ago

The problem was manifest on a Clearcase view (the actual volume is remote mounted). Is it possible that the issue is a timeout problem?

Due to an unrelated issue I physically copied the entire tree to a local drive. The problem does not manifest in this case.

The triplet of files is present, so the virus scanner possibility seems unlikely.

sean-mcmanus commented 6 years ago

Yeah, looks like there's some problem with the ClearCase view -- we've never heard of any user using that until now, although we have had some reported failures involving other remote file systems. I don't know if a timeout is occurring. You could try reducing your browse.path to create a smaller database file to see if that works (i.e. doesn't time out).

bobbrow commented 6 years ago

I would recommend you always keep the database on a local drive for performance and reliability reasons. You should be able to continue to use the same path you've always used if you really want though. We just recommend you delete the database that is currently there because it appears to be corrupted.

draeger-charles-wilson commented 6 years ago

That's a reasonable enough recommendation, but the crash condition is still lurking. Will you be able to handle the SQL fail condition?

If need be I'd be willing to run with an more chatty version of the extension.

sean-mcmanus commented 6 years ago

Our crashes related to SQLite are very low compared to other crashes, so we might get around to fixing those for a while. SQLite is an OSS project so the bug could exist in the version we're using or we could have a bug in our API (we updated our version used last year, which fixed some crashes). Wrapping the code in a exception handler to prevent a crash might also work.