The VSTS\TFS 2017 Release definition fails to create Release artifact directory at 'C:\Agents\DA_CID22\r1\a' - azure-devops

Lately I have been facing this error for one of my release definition and I am not able to figure it out why is this happening.
I tried manually deleting the folders inside the r1 directory but it fails to delete the 'a' folder i.e. artifact directory and says the folder or file in it is open in another program. But its shocking that the 'a' folder is empty and don't even have a hidden files and folders in it.
As a work around, to make the release successfully get deployed I have to restart my server each time whenever I want a new release to be deployed. Which is really very annoying.
Below is the complete error that I get on the Release definition summary.
Errors (2)
 Downloading artifacts failed:
Microsoft.VisualStudio.Services.Agent.Worker.Release.Artifacts.ArtifactDirectoryCreationFailedException:
Failed to create Release artifact directory 'C:\Agents\DA_CID22\r1\a'.
---> System.IO.IOException: The process cannot access the file '\?\C:\Agents\DA_CID22\r1\a' because it is being used by another
process. at System.IO.Win32FileSystem.RemoveDirectoryHelper(String
fullPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
at System.IO.Win32FileSystem.RemoveDirectory(String fullPath, Boolean
recursive) at
Microsoft.VisualStudio.Services.Agent.Util.IOUtil.DeleteDirectory(String
path, Boolean contentsOnly, Boolean continueOnContentDeleteError,
CancellationToken cancellationToken) at
Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseFileSystemManager.EnsureEmptyDirectory(String
directoryPath, CancellationToken cancellationToken) --- End of inner
exception stack trace --- at
Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseFileSystemManager.EnsureEmptyDirectory(String
directoryPath, CancellationToken cancellationToken) at
Microsoft.VisualStudio.Services.Agent.Worker.Release.RetryExecutor.Execute(Action
action) at
Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.CreateArtifactsFolder(IExecutionContext
executionContext, String artifactsWorkingFolder) at
Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.d__31.MoveNext()
 Failed to create Release artifact directory
'C:\Agents\DA_CID22\r1\a'.
Any help or advice would be really helpful.

This happens from time to time...I spent days trying to figure out with no easy solution (all the ones you have tried, I tried myself) but for restarting the private agent. My conclusion is that somehow the agent process got hung with the artifact Windows folder. You can see that with programs like https://lockhunter.com/. There's not an easy solution here...Sometimes you must kill the culprit process which not ended correctly freeing that file, or if you are lucky releasing the file handle to that file with a tool like said before...

Related

Unable to delete invalidated cache folder. Access to the path is denied

I'm getting the below error in CodeSmith Generator Studio, version 7.1.0 when rebuilding my template master cst file.
Error: Unable to delete invalidated cache folder. - Access to the path 'oipf2tbx.dll' is denied.
Stack Trace:
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at CodeSmith.Engine.Compiler.CacheManager.Delete(CacheEntry entry)
I've tried restarting my machine, restarting CodeSmith, and also deleting the contents of both PropertySetCache and TemplateCache in AppData\Local\CodeSmith\v7.1, but I'm still getting the error.
Any ideas of how I can make this error go away when rebuilding?

Visual Studio Test task fails randomly without error message, Exit code 1 returned from process: node.exe

We have this issue that has been plaguing our engineering group for over a year and we cannot make any progress on the resolution. This question on Stack Overflow is eerily similar to what we experience.
We have several pipelines that use the "Visual Studio Test" task to run a set of NUnit tests from a single assembly. There are 1400-1500 unit tests in the project and it takes The NUnit Test Adapter is deployed via the NuGet task (install NUnit3TestAdapter). This test assembly is built with the following settings:
MSBuild Architecture=x86
Platform=AnyCPU
Configuration=Release
Strong Name Signed
Across multiple pipelines, this step randomly yet consistently ends early with zero error message or trace of why the process ended. Running a subsequent build of the pull request will often result in a success but occasionally another failure. In this case we have coined this a "flaky build" where given the same exact code inputs, the build can fail and then subsequently pass.
This is the only error message we received from the pipeline:
##[error]Exit code 1 returned from process: file name 'REDACTED\externals\node\bin\node.exe', arguments '"REDACTED_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\runvstest.js"'.
Finishing: Integration Tests
These tests are our "integration tests" that perform many setup steps to create a functional version of our system including creating a web server via Kestrel to host our API, connect to (localdb) running on the build server to restore a database .bak file and apply a database project (dacpac) as well as connect to Redis (also installed locally on the build server).
We are struggling to determine next steps so I am reaching out to the community to see if anyone else has suffered through this issue, has ideas for how to debug the issue or perhaps even a solution!
edit on 2020-11-10
Yesterday I set the pipeline variable system.debug to true and this is the output it captured during one of our flaky builds.
##[error\]Exit code 1 returned from process: file name 'E:\\servername\\externals\\node\\bin\\node.exe', arguments '"E:\\servername\\\_work\\\_tasks\\VSTest\_ef087383-ee5e-42c7-9a53-ab56c98420f9\\2.170.1\\runvstest.js"'.
##[debug\]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code 1 returned from process: file name 'E:\\servername\\externals\\node\\bin\\node.exe', arguments '"E:\\servername\\\_work\\\_tasks\\VSTest\_ef087383-ee5e-42c7-9a53-ab56c98420f9\\2.170.1\\runvstest.js"'.
at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue\`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue\`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)

Azure Devops Pipeline Environment Resource Agent installation issue

I have been trying to add an environment resource to our pipeline in azure devops but every time i install it with the powershell script they provide it asks me for tags. If i don't want to input tags it errors. If i choose to put in tags it errors. Either way it starts over every time and it will never successfully install. Anyone know if this is something on my end or on their end? I looked through the diagnostic file and the exceptions it is logging look like it's something that i can't fix but i have been having issues with this for over a week and thinking it was something that Microsoft would realize and patch. Now i'm wondering if there is something else i can do?
[2020-05-22 13:01:48Z ERR VisualStudioServices] POST request to https://DEVOPS_URL/24cca667-60da-4ba2-a323-4e05c46f3309/_apis/pipelines/environments/3/providers/virtualmachines failed. HTTP Status: InternalServerError, AFD Ref: Ref A: 56C7161B437D41698EBBDE7ACBF4CAA2 Ref B: ATAEDGE0918 Ref C: 2020-05-22T13:01:48Z
[2020-05-22 13:01:48Z INFO CommandSettings] Flag 'unattended': 'False'
[2020-05-22 13:01:48Z ERR Terminal] WRITE ERROR (exception):
[2020-05-22 13:01:48Z ERR Terminal] Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: TF400898: An Internal Error Occurred. Activity Id: acb8a36a-e602-4988-b3f7-8fbeecd729e0.
---> System.NullReferenceException: TF400898: An Internal Error Occurred. Activity Id: acb8a36a-e602-4988-b3f7-8fbeecd729e0.
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable1 queryParameters, Object userState, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.AddAgentAsync(AgentSettings agentSettings, TaskAgent agent, CommandSettings command)
at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command)
I was experiencing a similar error "Failed to add virtual machine resource. Linked environment pool is null."
Answer from Kevin Ross here: https://developercommunity.visualstudio.com/t/addition-of-resource-to-environment-fails-for-user/1048111
I resolved my error by following the below steps:
Get the deployment pool ID from the environment URL
Find the deployment pool settings in the organization settings and navigate to the correct pool based on ID from step 1
From the deployment pool settings, go to security and add the required user to administrator role or whatever role is required

TFS vNext build agent installation [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I decided to start using the TFS build vNext pipeline and came across a strange issue during the configuration of my build agent. I would like to know if anyone else can replicate this and if so, how eventually can I solve the issue.
I installed the agent in the following directory D:\TFS Build Agent\agent and executed the configuration. The procedure went well and the agent is added correctly inside the given pool. Also the service is running correctly on my build machine.
However once I start a simple build I do get the following error:
09:10:23.570390 System.Management.Automation.ProviderInvocationException: Attempting to perform the NormalizeRelativePath operation on the 'FileSystem' provider failed for path 'D:\TFS Build Agent\agent\tasks\VSBuild\1.0.11'. Access is denied ---> System.UnauthorizedAccessException: Access is denied ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.FileSystemProvider.GetFileSystemInfo(String path, Boolean& isContainer)
at Microsoft.PowerShell.Commands.FileSystemProvider.NormalizeThePath(String basepath, Stack`1 tokenizedPathStack)
at Microsoft.PowerShell.Commands.FileSystemProvider.NormalizeRelativePathHelper(String path, String basePath)
at Microsoft.PowerShell.Commands.FileSystemProvider.NormalizeRelativePath(String path, String basePath)
at System.Management.Automation.SessionStateInternal.NormalizeRelativePath(ProviderInfo provider, String path, String basePath, CmdletProviderContext context)
--- End of inner exception stack trace ---
at System.Management.Automation.SessionStateInternal.NormalizeRelativePath(ProviderInfo provider, String path, String basePath, CmdletProviderContext context)
at System.Management.Automation.SessionStateInternal.NormalizeRelativePath(String path, String basePath, CmdletProviderContext context)
at System.Management.Automation.SessionStateInternal.SetLocation(String path, CmdletProviderContext context)
at System.Management.Automation.PathIntrinsics.SetLocation(String path)
at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken)
at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)
09:10:23.570390 BaseLogger.LogConsoleMessage(scope.JobId = 88ecf41a-efe1-48d4-b67a-462b166f2b4c, message = ##[error]Attempting to perform the NormalizeRelativePath operation on the 'FileSystem' provider failed for path 'D:\TFS Build Agent\agent\tasks\VSBuild\1.0.11'. Access is denied)
I tried to make sure to give all the full set of permissions for the account under which my service is running to the above mentioned folder, but it didn't changed anything.
Now I moved the files of the agent to the C drive to the C:\agent folder and re-done the same exact setup, and suddenly all worked as supposed.
Even if this solves my problem I would like to know more about this issue. Is this a bug or am I missing some specific privileges?
Can anyone replicate this issue?
Thanks
Disable UAC - with PowerShell, not the Control Panel.
Something like:
New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force
I've just had similar issue. Try setting service to local administrator, didn't do it. Disabling UAC appears to have been the cause.
Or directly in the registry I guess. Restart will be required to take effect.
I tried again to replicate this but with no success. It seems that there was some issue at the time with the machine I worked on.

'sqlite3.dll was not loaded' when trying to install GitHub

I am trying to install GitHub using GitHubSetup.exe, downloaded from windows.github.com. The setup program 'downloads' what it needs, then closes and does nothing more.
Looking at TheLog.txt (in AppData/GitHub) shows the following:
2015-04-09 12:18:24.0747|ERROR|thread: 1|CrashManager|Dumping Loaded Module List
2015-04-09 12:18:24.0325|ERROR|thread: 1|CrashManager|Aieeeeeeee!
System.TypeInitializationException: The type initializer for 'NativeMethods' threw an exception. ---> System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
--- End of inner exception stack trace ---
at SQLitePCL.SQLite3Provider.NativeMethods.sqlite3_open_v2(Byte[] filename, IntPtr& db, Int32 flags, Byte[] vfs)
at SQLitePCL.SQLite3Provider.SQLitePCL.ISQLite3Provider.sqlite3_open_v2(String filename, IntPtr& db, Int32 flags, String vfs)
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.SQLitePersistentBlobCache..ctor(String databaseFile, IScheduler scheduler)
at GitHub.Helpers.SqlitePersistentBlobCacheFactory.CreateBlobCache(String path)
at GitHub.Helpers.SharedCache.<>c__DisplayClass5.<.ctor>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at GitHub.Helpers.SharedCache.get_LocalMachine()
at GitHub.Helpers.AppLogManager.get_AnonymousIdentifier()
at GitHub.Helpers.HaystackTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)
2015-04-09 12:18:24.0747|ERROR|thread: 1|CrashManager|Inner Exception
System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
'sqlite3.dll was not loaded.' is also the error I get when I try to click on the GitHib shortcut that is placed on the desktop.
I am running Windows 8.1, 64 bit.
I have tried downloading a sqlite3.dll file and placing it in system32, but that does nothing. I have also explicitly told my firewall to allow connections for the setup program. I feel a little in over my head here - does anyone have any suggestions?
Please let me know if I need to provide any more information!
Thanks a lot!
Brendan here, one of the GitHub for Windows developers.
The latest update introduced a dependency that required a version of the Visual C++ Redistributable that wasn't installed as a pre-requisite. As a workaround, you can install the 32-bit version from here which adds it back in:
http://www.microsoft.com/en-us/download/details.aspx?id=30679