msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

C++ debug build fails in mounted volume in Docker container

Open Stannieman opened this issue 8 years ago • 8 comments

Steps to reproduce

  • Create a Windows Server Core Docker image with VS Build Tools 15.7 (lower should have the same issue).
  • Start a container with a folder from the host mounted as a volume inside the container.
  • Put a VS solution with C++ projects inside the volume, it should have PDB format (not C7 compatible).
  • Build the solution.

Expected behavior

Build succeeds

Actual behavior

Build fails with "cannot open program database". You can now see that mspdbsrv still has a lock on PDB file(s). When the solution is copied to inside the container (so it's not in a mounted volume anymore) and then built the same way it works correctly.

Environment data

msbuild /15.7 output:

c:\externalvolume\component-vshaper\vshaperlib\stdafx.cpp(9): error C2471: cann
ot update program database 'C:\externalvolume\component-vshaper\VShaperLib\Debu
g\VShaperLib.idb' [C:\externalvolume\component-vshaper\VShaperLib\VShaperLib.vc
xproj]

Handle output

../handle64.exe C:\externalvolume\component-vshaper\VShaperLib\Debug\VShaperLib.idb
Nthandle v4.11 - Handle viewer
Copyright (C) 1997-2017 Mark Russinovich
Sysinternals - www.sysinternals.com

mspdbsrv.exe       pid: 1284   type: File           12C: C:\externalvolume\component-vshaper\VShaperLib\Debug\VShaperLib.idb

Stannieman avatar May 31 '18 09:05 Stannieman

I am also experiencing this issue.
Host OS: Windows 10 (Version 1709 (OS Build 16299.334)) Docker version: 18.03.1-ce, build 9ee9f40 Container OS: Windows 10.0.14393.2125 Container VS Build Tools: Microsoft (R) Build Engine version 15.6.85.37198 for .NET Framework Container Command: MSBuild.exe C:\my_mount\my_sln.sln /target:Rebuild /property:Configuration=Debug /property:Platform=x64 /property:_IsNativeEnvironment=true Results in error C2471: cannot update program database

cowlinator avatar Jun 25 '18 23:06 cowlinator

Same for me with: Docker version: 18.06.1-ce-win73 OS Image: windowsservercore:1803_KB4457128 MSBuild: 15.8.169.51996

Siron777 avatar Oct 16 '18 13:10 Siron777

Just a remark for other people that like to have this working: I discovered that even if it would work it's not the ideal way to go. When running in Hyper-V isolation mode the disk IO to a mounted volume is a rather slow compared to IO to files inside the container itself. I suspect this is due to the isolation and there is probably no such performance hit when running native containers. Because compilation usually creates a lot of random IO to lots of small source files your compilation time will be longer.

Stannieman avatar Oct 16 '18 16:10 Stannieman

I get the same error, but my environment is slightly different: I am also trying to build inside a Docker container, but using CMake + Ninja instead of MSBuild. I ge the error C2471 about vc140.idb, but on the host I get that the file is locked by "vmwp.exe". I am using HyperV isolation. So it seems to be a problem with the way the compiler is writing to its idb file, because I can create, update and delete regular files just fine. There is a bug here, not just related directly to msbuild.

RoguePointer80 avatar Sep 02 '19 20:09 RoguePointer80

@olgaark can you take a first look on this?

This does not look like a MSBuild bug. I would recommend maybe filling a VS Feedback ticket through VS. It might get triaged to the appropriate team faster that way.

livarcocc avatar Sep 09 '19 22:09 livarcocc

Also seeing this behavior

winstonhenke avatar Sep 30 '19 01:09 winstonhenke

+1 for me, can't build package using conan in the docker container (windows server 2019, container with vs buildtools 2019). After some time, build fails with error: "error C2471: cannot update program database ..."

mourogurt avatar Jul 07 '21 22:07 mourogurt

This does not look build system related. Please open a VS feedback and it will be routed to the correct team.

olgaark avatar Jul 07 '21 22:07 olgaark