#1
|
|||
|
|||
'Rename files' step fails
I have one step producing file addedResults.xml by applying some styles with msxsl.exe.
This is followed by another step-renaming addedResults.xml to an existent results.xml(I chose option to delete the existent files if found). Until today everything was ok but from 10 am (strange it started precisely at this hour :-) ) this step continously fails: //************* Output of the step was: Renaming files in 'D:\Reports\BuildsOutput\2007.1212.1.0\'... Deleting results.xml addedResults.xml -> results.xml The process cannot access the file because it is being used by another process. //************* Is there any possiblity to rename this file even if it is in use? I did not discover yet what process is using this file,I tried with FileMon but box frozen. But after the build process finished I tried manually to rename that file and it was ok,so only during the build it is reported as in use. |
#2
|
|||
|
|||
The Rename Files action uses the DeleteFile and MoveFile APIs to delete and rename files, which will fail if the file is in use. VBP built-in actions from previous steps will not keep a handle open to any files that are processed, so there must have been something else that kept the file open.
|
#3
|
|||
|
|||
I tried some workaround-introduced a Wait step for 10 sec-between the step producing addedResults.xml and the step renaming addedResults.xml.This seems to solve the issue but I do not understand exactly why.
But now I begin to have other issues-I have a step setting File version for a C# solution,from this morning it fails: Error firing vbld_StepDone event: Error in Step (VBScript) script code at Line 32, Column 1 (Permission denied) where the line failing is; Set file=vbld_FSO().OpenTextFile(strCurrProjLogFullPat h,ForAppending,TRUE) I just open a file in order to write inside the content of LASTSTEP_OUTPUT. Previous step is writing into this file as well. I suspect this error is somehow related with the previous one with 'Rename Files'.It is like something happened yesterday on the build box so from that moment a VBP step would keep a file locked more than normal so next step would find the file locked and it would fail.But you wrote this is not possible so I really have no real clue about what is going on :-( |
#4
|
|||
|
|||
What changed on the box when the problem started happening? Do you have any active scanning anti-virus or other security/resident software that could somehow interfere with VBP's access to files? Something other than VBP is keeping the files open.
|
#5
|
|||
|
|||
I checked-only changes I found were 2 Win2003 updates but I am not sure about the hour they ocurred.
On that box is installed NOD32 antivirus. I just noticed another issue happening from yesterday:some unit tests are not performed correctly because the related coverage log is reported in use. The affected unit tests are randomly ,they change with each build. I launch unit tests from a NCover step in VBP. ***************************** "C:\Program Files\NCover\NCover.Console.exe" "C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe" "MyComp.ExConn.IConnector.Tests.dll" //w D:\LatestUnitTestBinaries\NightlyTrunk //a MyComp.ExConn.IMarketDataConnector //ea MyComp.TranslatorGen.GeneratedTranslatorAttribute; MyComp.NG.Serialization.GeneratedSerializatorAttri bute //l D:\Reports\NCover\08.1.1017.0\MyComp.ExConn.IConne ctor.Tests.dll.Coverage.log //x D:\Reports\NCover\08.1.1017.0\MyComp.ExConn.IConne ctor.Tests.dll.Coverage.xml /noshadow /xml:"D:\Reports\UnitTests\08.1.1017.0\MyComp.ExCon n.IConnector.Tests.dll.xml" NCover.Console v1.5.5 - Code Coverage Analysis for .NET - http://ncover.org Copyright (c) 2004-2005 Peter Waldschmidt Command: C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe Command Args: "MyComp.ExConn.IConnector.Tests.dll" "/noshadow" "/xml:D:\Reports\UnitTests\08.1.1017.0\MyComp.ExConn .IConnector.Tests.dll.xml" Working Directory: D:\LatestUnitTestBinaries\NightlyTrunk Assemblies: MyComp.ExConn.IMarketDataConnector Coverage Xml: D:\Reports\NCover\08.1.1017.0\MyComp.ExConn.IConne ctor.Tests.dll.Coverage.xml Coverage Log: D:\Reports\NCover\08.1.1017.0\MyComp.ExConn.IConne ctor.Tests.dll.Coverage.log Waiting for profiled application to connect...Connected Configuring Profiler... ******************* Program Output ******************* Unhandled Exception: System.IO.IOException: The process cannot access the file 'D:\Reports\NCover\08.1.1017.0\MyComp.ExConn.IConn ector.Tests.dll.Coverage.log' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter.CreateFile(String path, Boolean append) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding) at NCover.Framework.ProfilerMessageCenter.LoggingThre ad(Object profiler) at System.Threading.ThreadHelper.ThreadStart_Context( Object state) at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart(Object obj) Process completed with exit code -532459699 |
#6
|
|||
|
|||
I think I am able now to reproduce this issue even more clearly.
I have a group of steps: 1)copy file ProjDep.Console.exe into folder A (VBP copy files step) 2)launch ProjDep.Console.exe using VBP Run Program step 3)delete file ProjDep.Console.exe into folder A (VBP delete files step) I try to run "Rebuild group" action several times->sometimes is ok,but sometime it says build failed on step 3: build '2007.1213.2.0' has failed on step 'Delete dependency binary files'. Output of the step was: Delete files in folder 'D:\Reports\BuildsOutput\2007.1213.2.0\'... ProjDep.Console.exe Error deleting file 'D:\Reports\BuildsOutput\2007.1213.2.0\ProjDep.Con sole.exe': Access is denied. 0 file(s) deleted Notes: -if I put a "Wait" step for 5 seconds between 2) and 3) ->error did not appear -If I replace step 3 with a Run Program step and calling del command for file deletion-error did not appear -after group actions executed and deletion failed-if I try to manually delete the file ProjDep.Console.exe ->no problem appears. So I think whatever happened on that bld box-it seems to affect Visual Build steps only. Problem is I don't know how to determine exactly what is causing the file to remain locked after VBP step "Run Program" finished. |
#7
|
|||
|
|||
I don't know either, but I'm pretty sure that VBP itself is not keeping the file in use. I ran the attached project continuously on Win XP SP2 w/ VBP v6.6 for several minutes, and it is always able to delete the file right after copying and running it. If I single step the build and open %TEMP%\A\xcopy.exe with Visual Studio 2003 (which locks it while open) after the copy step, the delete step fails (as expected).
|
#8
|
|||
|
|||
Thanks a lot for the sample build,it is a very good way to test this strange issue I am experiencing.
So I tried your delrun.bld on my box(WinXpSP2 single processor)-everything ok,the step Delete Files never fails. Then I tried on the build box(Win2003Server Dual Core)->after the cycle is running couple of times -the step Delete Files fails: 12/14/2007 11:10:06 AM: Building project step 'Delete Files'... Delete files in folder 'C:\DOCUME~1\A~1.B\LOCALS~1\Temp\1\A\'... xcopy.exe Error deleting file 'C:\DOCUME~1\A~1.B\LOCALS~1\Temp\1\A\xcopy.exe': Access is denied. 0 file(s) deleted 12/14/2007 11:10:06 AM: Step 'Delete Files' failed 12/14/2007 11:10:06 AM: Build ended. I made a small modification,tried on the build box the bld attached (delrun_modified.bld),xcopy.exe would be launched properly to copy some files->in this case even the first cycle fails on step "Delete Files"-same reason,Access denied. On my box -this delrun_modified.bld runs without any problem. So what should I do next in order to fix this issue on build box??? |
#9
|
|||
|
|||
Figure out what is opening the file(s) and uninstall or disable it. I would start with temporarily disabling or removing any anti-virus, security, or other resident software. Another option would be to format the hard drive and reinstall Windows.
|
|
|