10

We have CruiseControl.NET set up to do continuous integration of a number of our projects.

We are using a <cb:define> block to make sure all of our source control operations are done in the same way, and to keep the config DRY.

We are experiencing an issue every once in a while that cause the build to show "Exception". The message is as follows:

ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation has timed out. 
    at ThoughtWorks.CruiseControl.Core.Sourcecontrol.ProcessSourceControl.Execute(ProcessInfo processInfo) 
    at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Svn.GetModifications(IIntegrationResult from, IIntegrationResult to) 
    at ThoughtWorks.CruiseControl.Core.Sourcecontrol.QuietPeriod.GetModifications(ISourceControl sourceControl, IIntegrationResult lastBuild, IIntegrationResult thisBuild) 
    at ThoughtWorks.CruiseControl.Core.IntegrationRunner.GetModifications(IIntegrationResult from, IIntegrationResult to) 
    at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request)

The common config section is as follows:

<sourcecontrol type="svn">
    <trunkUrl>http://ourserver/svn/$(project-svn-path)/trunk/</trunkUrl>
    <executable>C:\Program Files\CollabNet Subversion Server\csvn.exe</executable>
    <username>user</username>
    <password>password<password>
    <revert>true</revert>
</sourcecontrol>

I would like to ignore this specific error, if possible.

What changes do I need to make?

John Gietzen
  • 48,783
  • 32
  • 145
  • 190
  • Surely if you ignore a source control timeout, you are not reliably building the most recent revision and your "continuous integration" build is meaningless? – David M Jan 18 '10 at 15:18
  • @David M: Well, this usually happens during an SLA window when the SVN server goes down for maintenance. This is not an exceptional circumstance, so I would like to ignore the issue if it happens for less than a few hours. – John Gietzen Jan 18 '10 at 15:34
  • We have an internet hosted svn server and a flaky internet connection. Everytime the connection goes down we get a failed build - which is not useful it all. So thanks for the question. – Greg Woods Oct 27 '11 at 08:58

3 Answers3

16

Here's a block I use to prevent these kinds of errors affecting the build status:

<maxSourceControlRetries>5</maxSourceControlRetries>
<stopProjectOnReachingMaxSourceControlRetries>true</stopProjectOnReachingMaxSourceControlRetries>
<sourceControlErrorHandling>ReportOnRetryAmount</sourceControlErrorHandling>

You need to put these right below the <project> tag, not the <sourcecontrol>. I'm not sure you'll be able to ignore just the "timed out" exception, though - all SVN exceptions will be treated the same.

UPDATE: you can find out more about these settings in the CC.NET documentation, but let me copy the relevant stuff:

maxSourceControlRetries: The maximum amount of source control exceptions in a row that may occur, before the project goes to the stopped state(when stopProjectOnReachingMaxSourceControlRetries is set to true).

stopProjectOnReachingMaxSourceControlRetries: Stops the project on reaching maxSourceControlRetries or not. When set to true, the project will be stopped when the amount of consecutive source control errors is equal to maxSourceControlRetries.

sourceControlErrorHandling: What action to take when a source control error occurs (during GetModifications). These are the possible values :

  • ReportEveryFailure : runs the publisher section whenever there is an error
  • ReportOnRetryAmount : only runs the publisher section when maxSourceControlRetries has been reached, the publisher section will only be run once.
  • ReportOnEveryRetryAmount : runs the publisher section whenever the maxSourceControlRetries has been reached. When maxSourceControlRetries has been reached and the publisher section has ran, the counter is set back to 0.
Kenneth Xu
  • 1,514
  • 15
  • 15
Igor Brejc
  • 18,714
  • 13
  • 76
  • 95
  • I'm gonna mark this one as accepted, even though I don't have a way to test it necessarily. Could you do me a favor and explain each of those entries? – John Gietzen Jan 18 '10 at 15:30
  • I've updated the answer with some CC.NET docs. Let's just say that I've had the same problem with SVN timeouts (usually during the night) and often the build status was marked as "Exception" because of it. After playing with these settings a bit, I settled on the ones I posted here and I haven't had any problems after that. You might want to play with these yourself (by increasing the retries count, for example). – Igor Brejc Jan 18 '10 at 16:57
  • I am using the same configuration - sadly, it does not solve the issue. My network admin has a bad habbit of breaking the network at random intervals, which marks all our build red until someone forces a build manually. – skolima Jan 18 '10 at 20:02
  • 2
    Then the problem isn't in CC.NET or SVN... force rebuild your network admin ;) – Igor Brejc Jan 19 '10 at 05:36
8

Can't you just increase the 'timeout' value ?

<sourcecontrol>
   ...
   <timeout>60000</timeout> <!-- timeout in milliseconds -->
   ...
</sourcecontrol>
Frederik Gheysels
  • 56,135
  • 11
  • 101
  • 154
  • The problem generally happens overnight, when either the server is actually down, or something like that. – John Gietzen Jan 18 '10 at 15:26
  • 4
    Thanks. This helped with the issue I was having. Although we had to use 1 you pointed us in the right direction. +1 to you. – David Jun 20 '11 at 17:21
0

In addition to the accepted answer. I found it helped us a lot by using url trigger.

<triggers>
  <urlTrigger url="http://url.to.your.svn.server" />
</triggers>

So if the server is not reachable, CCNet won't event trigger a build. That effectively reduced the chance of failures.

Link to Documentation of URI Trigger.

Update: we never had a single false failure caused by svn server connectivity issue after above line was in place for near 2 months.

Kenneth Xu
  • 1,514
  • 15
  • 15