100% CPU in vbc.exe when compiling large vb.net web applications in Microsoft Visual Studio 2008

1 minute read

We just released a hotfix for an issue where you get 100% CPU in vbc.exe when compiling large applications in Microsoft Visual Studio 2008.

Apart from the 100% CPU situation you may also notice symptoms like visual studio taking a very long time to return or error messages like

Error    246    Timed out waiting for a program to execute.
The command being executed was "C:\Windows\Microsoft.NET\Framework\v3.5\vbc.exe" /noconfig @"C:\TempFiles\MyApp\8ec39ce7\e41b4e32\gpznqwbu.cmdline".


C:\MyProjects\MyPage.aspx(4): Build (web):
Object '/32eba493_7a69_40af_bfe6_52887ab07396/jdkqqpvt_pufe5n+ogossdnv_258.rem' has been disconnected or does not exist at the server.

The issue will not appear if you set debug="false" in web.config.

The reason for this issue is that vbc.exe (the vb.net compiler) is spending a lot of time compiling and copying pdb files (symbol files) and to confirm that you are running into this issue you can take a hang dump with adplus (adplus -hang -pn vbc.exe) while vbc.exe is running at high CPU. If you open it up in windbg.exe and set up the symbols correctly (.symfix c:\websym) and then run ~* kb to list all stacks, you should see a stack similar to the following:

0:000> kb 2000
ChildEBP RetAddr  Args to Child
0023ed84 00cc1b80 08a10cdc 0023f228 08a11bfc vbc!BCITER_CHILD::GetNext+0x4a
0023edbc 00cc1ad8 08a11bfc 08a10ec0 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x237
0023edf8 00cc1ad8 08a10cdc 088a10a4 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023ee34 00cc1ad8 088a0ec0 087e1288 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023ee70 00cc1ad8 087e10a4 088a146c 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023eeac 00cc1ad8 088a1288 087611ac 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023eee8 00cc1ad8 08760fc8 088310c0 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023ef24 00cc1ad8 08830edc 07c21488 0023f228 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023ef60 00cc1ad8 07c212a4 099717d4 0043a7b0 vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023ef9c 00d0c588 08cb0144 009353ec 00d0c68d vbc!PDBExtensionTypeIterator::FindExtensionsFromNamespace+0x22f
0023efa8 00d0c68d 8c83e39e 099717d4 00469a40 vbc!PDBExtensionTypeIterator::PopulateExtensionTypes+0x1c
0023f388 00d0c327 009353ec 099717d4 8c83e3ee vbc!PEBuilder::WritePDB2+0x10c
0023f3f8 00d0c554 009353ec 00000000 0023f686 vbc!PEBuilder::WritePE+0x380
0023f4f8 00d1eeb2 00000000 0023f686 0023f51c vbc!PEBuilder::Compile+0x3ea
0023f688 00d1ecce 000000e8 07643fe8 009385d4 vbc!CompilerProject::_PromoteToCompiled+0x7e
0023f6a0 00d1f0c4 8c83e716 00000001 001247f0 vbc!CompilerProject::CompileFromBoundToCompiled+0xd3
0023f700 00d41a9e 00430268 0023f750 0023f74c vbc!Compiler::Compile+0x139
0023f760 00d41cd6 00000003 00469ad0 00123e00 vbc!wmain+0x23f
0023f7a4 7587e3f3 7efde000 0023f7f0 773acfed vbc!`vector constructor iterator'+0x184
0023f7b0 773acfed 7efde000 54d0fe52 00000000 kernel32!BaseThreadInitThunk+0xe
0023f7f0 773ad1ff 00d54b2e 7efde000 ffffffff ntdll!__RtlUserThreadStart+0x23
0023f808 00000000 00d54b2e 7efde000 00000000 ntdll!_RtlUserThreadStart+0x1b

The fix involves two hotfixes (KB 951708 for Visual Studio 2008, and KB 953595 for vbc.exe). The KB articles will be published soon but even though the KB articles are not yet published you can still get these hotfixes by contacting support and supplying the kb article numbers 951708 and 953595.

Laters, Tess