Prevent CruiseControl.NET error “Source control operation failed: Working copy locked svn”

My CruiseControl.NET build system was running into an error whenever two projects were trying to build at the same time.  Both of these projects try to go out to our subversion source control repository and one will win and the other gets locked out.

The build will then fail with this type of error:

ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation failed: svn: Working copy 'XXXX' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) .

To get around this issue you can use the “queue” attribute of the project node:

image

Here is the Thoughtworks CruiseControl.NET Project configuration reference section: http://confluence.public.thoughtworks.org/display/CCNET/Project+Configuration+Block

Originally I did not set a queue value for each project that is built.  The default in this instance is the project name, so each project ends up in its own queue and therefore they will build as soon as possible and cause the locking error.

From the Thoughtworks reference:

queue 
The name of the integration queue that this project will use. By default, each project runs in its own queue. (Added in CCNet 1.3) 

So by setting the queue for each of the projects to the same value (since all of the projects are related), each of them will wait and build one at a time, resolving the “Source control operation failed: svn: Working copy 'XXXX' locked svn” error.

Note: You can also set the queuePriority to indicate the order the project should build when it is in the queue.

This StackOverflow post lead me to this solution: How can I prevent concurrent builds in CruiseControl.NET?



No Comments