Skip to content

Problem with locked files in visual studio

Today I have had reakkt annoying problem with VS Express. I am using express edition since it came out and I have never experienced this before.

I tried to compile glut examples (from glut 3.7.6 source code). I opened the old redbook .dsw file and VS happily converted it to new .sln file with many projects (one per example). After adding some preprocessor flags to get rid of annoying POSIX deprecations, and to fix glut bug with stdlib exit, I hitted batch build and hoped for the best. Unfortunately I got error on all projects but one! The error said that vc90.pdb and vc90.idb can’t be deleted and compiling couldn’t proceed further. I looked in debug folder and that was true. There were those files, and they were not deletable even after I quited VS. I reopened VS but the error was still there. For some reason, those files were write- protected, and I wasn’t able to remove write protection through the explorer neither. I searched the web, but really haven’t found much. I did have some suspicions on multithreading and some stupid deadlock somewhere deep in VS, since I am running on quad core with 4 builds enabled in parallel. Results from google favored in that direction. I have got only one relevant hit back from google.

As suggested there, I disabled parallel building, and try to rebuild everything with only 1 build at the time. Nope. Now it was even worse; compiler just blocked and nothing happened. I was able to cancel build and restart it again, but after restart, compiler just stand there on first .c file without doing anything. Restarting VS didn’t helped much, and I refused to restart entire computer just for this. A matter of princip! This is not windows 98 for god sake!

Instead I found the problem with help of Process Explorer, a tool from Sysinternals. It is really great tool! I just did a search on handles, and PE showed that some process named mspdbsrv.exe holed several handles to those files. Another search on google, this time with more luck, revealed that mspdbsrv.exe is indeed process that belongs to VS. I am not sure what it does, but it seems like it is there to provide synchronized access to shared files during the build. To bad it deadlocks itself – by opening several handles to same file :-). I just killed that process through PE, and voilá – everything worked without problems again.

I don’t know why that error happened, but it didn’t repeat again. After that I have managed to compile all demos and examples, that comes in glut programs directory. I also never before had this problem. It probably appears only in multicore environments; since I have never experienced this on my old p4.

Post a Comment

Your email is never published nor shared. Required fields are marked *