dotnet / dotnet/msbuild

File locked by System process in Docker build

Open
#4,955 11 comments 2 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

hi @rainersigwald following information will be helpful for you, please ping me anytime if you need further clarification.

### **- What kind of project(s) do you have? :**
I will tell here all the background information with all the tools we using. We having a private repository in GIT calls "TownSuite/WebPortals" it is a Web Site based on ASP.NET framework and mainly _C#,Java Script_ languages . We have several Multiple _c# projects_ and I will explain you the exact build process later.

The GIT source code build, Test & deployment process we initiated by using our Jenkins CI server. So we have Jenkins master server connecting with Jenkins windows slave node. So Jenikins downloading "TownSuite/WebPortals" Source-Code on to that windows Slave node when start the Build process via Jenkins. Inside that Jenkins windows slave node we have installed Docker Desktop for the purpose of run Windows docker containers on top of that Windows slave node. So that downloaded Source-code we can mount inside the docker container.

### **- Which Docker image are you using? :**
We using a Windows based Docker image. Actually we having _powershell_ scripts **_(buildrelease-ng-docker.ps1 & buildrelease-ng.ps1)_** running within our Jenkins file for build and test our WebProjects. So first we run buildrelease-ng-docker.ps1 as below for run the docker container.
![image](https://user-images.githubusercontent.com/44959238/70196007-537eaf80-172d-11ea-8fd8-22398088b7dc.png)
Here I highlighted in yellow the docker build image.

### **- How are you building it in the Docker container?**
So as you can see in above image first we running the docker image and we running out build script _**".\buildrelease-ng.ps1"**_ at the same time inside the docker container. So all our build tool (MSBuild) and Build command we specifiy inside that buildrelease-ng.ps1 script. I will show an image of inside the buildrelease-ng.ps1 script as below.
![image](https://user-images.githubusercontent.com/44959238/70196536-fe439d80-172e-11ea-9563-1a5728fdad7c.png)
So here I Highlighted only a one of the build commands for build one Web.Sln project. Here MSBuild tool we already have installed inside the docker container in following path. $MSBUILD="C:\BuildTools\MSBuild\15.0\Bin\MSBuild.exe".

### **- What is the exact error you're seeing, including the file that is locked?**

Below is the exact I'm getting on my Jenkins Log Output when Building inside docker container by using the MSBuild tool.
![image](https://user-images.githubusercontent.com/44959238/70196730-b2ddbf00-172f-11ea-8cec-5f677bc9fb16.png)

This is only one error these kins of errors happening several times on the log when copying several different dll files.

### **- If possible, please include binary logs ?**

I don't know how to get binary logs. Is it the logs for MsBuild ?

_Originally posted by @AmilaDevops in https://github.com/microsoft/msbuild/issues/4743#issuecomment-561920651_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with buildrelease-ng-docker.ps1 and buildrelease-ng.ps1, then review the Jenkins log around the repeated DLL copy failures and the MSBuild invocation at C:\BuildTools\MSBuild\15.0\Bin\MSBuild.exe. Reproduce the Windows Docker build and collect the MSBuild binary logs requested in the thread. Done means the file-locking cause is identified and the affected build completes without the repeated locked-file errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, powershell
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.