TeamCity Build Fails Because NUnit is Locking Files?

2.1k views Asked by At

We have been having an issue with our project's Continuous Integration. Occasionally, we want to try to clean all of the files on build within TeamCity in its checkout directory. Whenever we try to do this, nunit-agent.exe ends up remaining open from the previous build, yielding the following errors:

[05:35:40]: [Updating sources: Agent side checkout...] Failed to delete file: C:\TeamCity\buildAgent\work\path\to\UnitTestResults.xml
[05:35:40]: [Updating sources: Agent side checkout...] Failed to delete file: C:\TeamCity\buildAgent\work\path\to\src\packages\NUnit.2.5.7.10213\Tools\lib\nunit-console-runner.dll
[05:35:40]: [Updating sources: Agent side checkout...] Failed to delete file: C:\TeamCity\buildAgent\work\path\to\src\packages\NUnit.2.5.7.10213\Tools\lib\nunit.core.dll
[05:35:40]: [Updating sources: Agent side checkout...] Failed to delete file: C:\TeamCity\buildAgent\work\path\to\src\packages\NUnit.2.5.7.10213\Tools\lib\nunit.core.interfaces.dll
[05:35:40]: [Updating sources: Agent side checkout...] Failed to delete file: C:\TeamCity\buildAgent\work\path\to\src\packages\NUnit.2.5.7.10213\Tools\lib\nunit.util.dll
[05:35:40]: [Updating sources: Agent side checkout...] Failed to delete file: C:\TeamCity\buildAgent\work\path\to\src\packages\NUnit.2.5.7.10213\Tools\nunit-agent.exe

We always have to ask someone who has access to the box to manually kill the process before the build starts working again. What reasons would NUnit have to remain open indefinitely (we can wait 24 hours and it'll still be hanging)? Is there some command we need to use in our build script to force it to terminate, or to tell TeamCity that if a program hangs to force close it?

4

There are 4 answers

1
redsquare On

Have you tired setting the 'fail build if it runs lonnger than x' setting?

See http://confluence.jetbrains.net/display/TCD5/1.General+Settings

Check this option and enter a value in minutes to enable time control on the build. If the specified amount of time is exceeded, the build is automatically canceled. This option helps to deal with builds that hang and maintains agent efficiency.

1
flipdoubt On

No stunning insights on my part, only the obvious:

  1. Updating to the latest version usually helps.
  2. Is the failing "Full Build (dev branch)" the only configuration using "agent side checkout"? The others I looked at all use "server side checkout". I'm no expert on the difference, but are you sure you need it?
0
AudioBubble On

Use Swabra plugin, Luke It is included by default

0
JamesEggers On

I had this issue too. I upgraded to 2.6.012035 and it is now working for me.