Saturday, August 15, 2009

Hudson: svn authentication cancelled

The Hudson was building all projects without any issues since it was installed. All of a sudden yesterday my inbox was filled with failure reports, Hudson was not able to build any of the projects. Logs were having stacktrace like mentioned below-

ERROR: svn: authentication cancelled
org.tmatesoft.svn.core.SVNCancelException: svn: authentication cancelled
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:37)
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:32)
    at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getNextAuthentication(DefaultSVNAuthenticationManager.java:200)
    at hudson.scm.FilterSVNAuthenticationManager.getNextAuthentication(FilterSVNAuthenticationManager.java:42)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:537)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:273)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:261)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:516)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:98)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1001)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.testConnection(DAVRepository.java:97)
    at hudson.scm.SubversionSCM$DescriptorImpl.checkRepositoryPath(SubversionSCM.java:1686)
    at hudson.scm.SubversionSCM.repositoryLocationsExist(SubversionSCM.java:1826)
    at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:506)
    at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:469)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:898)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:391)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:340)
    at hudson.model.Run.run(Run.java:1090)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:301)
    at hudson.model.ResourceController.execute(ResourceController.java:93)
    at hudson.model.Executor.run(Executor.java:122)
Skipping sonar analysis due to bad build status FAILURE
Finished: FAILURE


The stack trace talks about authentication cancellation not failure, which is quite strange. I still thought that it might be an authentication failure and tried to authenticate against SVN server using same credentials as used by Hudson. Authentication was successful using various methods (browser, command line client, TortoiseSVN). Google search did not provided any relevant information and I was running out of clues :-(

After putting lots of pondering I remembered that day before I did a manual (from console) project checkout on the same machine and during checkout svn client (1.6.4) asked to save the password and I said 'no'. Will that make any difference? I think it should not.

Just for the sake of trial I deleted the '~/.subversion' directory and did a Hudson build after that. Now Hudson was able to do SVN checkout/update and build project. After several trials, I concluded that if password is not saved during manual checkout, Hudson will fail with above-mentioned error. Though it will wok fine if password was saved. Another observation was that Hudson SVN client (SVNKit 1.3.0) does not create '~/.subversion/auth', while 'svn' command does, irrespective of one chooses to save the password or not.

Though I do not know why Hudson (SVNKit) cancels the SVN authentication but removing the '~/.subversion' directory solves the issue.

16 Comments: