Intermittent "error initialising workspace Exception: UnauthorizedAccessException"

For some reason we have suddenly (in the last 7 days) started getting the following intermittent error during the Server To Agent Workspace Sync build stage. Once this happens every build fails on all projects with the same error until I restart the CI Agent service.

An error occurred while syncing files from the server to the agent. Details: Exception: UnauthorizedAccessException
Message: Access to the path ‘C:\Continua\CI_WS\Ws\76309__variables\FLREP001_Environment.xml’ is denied.
Stack Trace: 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, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.StreamWriter…ctor(String path) at Continua.Stepping.Variables.VariableUtilities.Serialise(VariableNamespace variableNamespace, String filePath) at Continua.Modules.Builds.Agent.AgentBuildHelper.CreateVariableNamespaces() at Continua.Modules.Builds.Agent.AgentBuildHelper.InitialiseWorkspaceOnAgent(IAgentCallbackProxy proxy, TransportContextDTO source, Guid callId)


 Any idea what could be causing this error and how we can stop it recurring please?

We are using Continua version 1.8.1.277 and the server and agent are running on the same machine.

Thanks
Darren

Hi Darren, 

Can you upgrade to the latest version? There was a recent fix to an issue where processes were not being terminated when a build is stopped and this which may be the cause of this error.

Otherwise can you check that there are no other processes running on your agent which may be holding a lock to the file. This could be a process spawned from one of your build actions, an external backup process or anti-virus software.

Generally, we recommend excluding the workspace folders from real-time anti-virus protection as this can significantly affect performance. Note, however, that you should continue to run scheduled anti-virus scans on these folders (preferably during periods when the service is unlikely to be busy).  

Will do. Thanks Dave

Hi Dave

We’ve upgraded Continua to version 1.8.1.664 but are still getting the same intermittent error. Any other ideas please?

Regards
Darren

Hi Darren,

As we are unable to reproduce this issue we would need some information about your scenario. Firstly, if you haven’t already done so, can you check that if there are any processes running on your agent when the error happens which may be holding a lock to the file and disable anti-virus real-time protection for this folder. 

Does this start happening when running a build for particular configuration? If so, what type of actions are in this configuration? Does the build have more than one stage - if so it is happening at the start of the first stage or a later stage? What are the workspace rules for this stage? The diagnostics report downloadable from the Administration -> Event Log page will contain details of the actions and workspace rules. If you can send this to support@finalbuilder.com we use this information to attempt to reproduce your issue. 

Can you also check if there are any errors in the Windows application or system event logs related to file access?