Tag: svn

Jenkins reports error on SVN update

One day a Jenkins server I use for Continuous Integration stopped updating code from SVN repositories. It reported an error ERROR: Failed to update https://svn.matuera.net/svn/project whilst throwing an SVNException.

In this post I describe how I was able to fix the problem and let the builds continue.

Stacktrace

The stacktrace that Jenkins reported was:

ERROR: Failed to update https://svn.daangemist.nl/svn/project
org.tmatesoft.svn.core.SVNException: svn: E175002: OPTIONS /svn/project failed
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:379)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:364)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:352)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:708)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:628)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:103)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1018)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.getRepositoryUUID(DAVRepository.java:148)
    at org.tmatesoft.svn.core.internal.wc2.SvnRepositoryAccess.createRepository(SvnRepositoryAccess.java:106)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgRepositoryAccess.createRepository(SvnNgRepositoryAccess.java:210)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgAbstractUpdate.updateInternal(SvnNgAbstractUpdate.java:144)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgAbstractUpdate.update(SvnNgAbstractUpdate.java:76)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgUpdate.run(SvnNgUpdate.java:38)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgUpdate.run(SvnNgUpdate.java:18)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
    at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:20)
    at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
    at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:291)
    at org.tmatesoft.svn.core.wc.SVNUpdateClient.doUpdate(SVNUpdateClient.java:311)
    at org.tmatesoft.svn.core.wc.SVNUpdateClient.doUpdate(SVNUpdateClient.java:291)
    at org.tmatesoft.svn.core.wc.SVNUpdateClient.doUpdate(SVNUpdateClient.java:387)
    at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:143)
    at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:153)
    at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:903)
    at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:884)
    at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:867)
    at hudson.FilePath.act(FilePath.java:909)
    at hudson.FilePath.act(FilePath.java:882)
    at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:843)
    at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:781)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1408)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
    at hudson.model.Run.execute(Run.java:1603)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:246)
Caused by: svn: E175002: OPTIONS /svn/project failed
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:154)
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:97)
    ... 38 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: E175002: OPTIONS request failed on '/svn/project'
svn: E175002: Received fatal alert: bad_record_mac
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:754)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:373)
    ... 37 more
Caused by: svn: E175002: OPTIONS request failed on '/svn/project'
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:752)
    ... 38 more
Caused by: svn: E175002: Received fatal alert: bad_record_mac
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:109)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:505)
    ... 38 more
Caused by: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1781)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1024)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1208)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:674)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:119)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.sendData(HTTPConnection.java:313)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPRequest.dispatch(HTTPRequest.java:168)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:460)
    ... 38 more
ERROR: Subversion update failed
java.io.IOException
    at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:184)
    at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:153)
    at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:903)
    at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:884)
    at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:867)
    at hudson.FilePath.act(FilePath.java:909)
    at hudson.FilePath.act(FilePath.java:882)
    at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:843)
    at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:781)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1408)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
    at hudson.model.Run.execute(Run.java:1603)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:246)
Caused by: hudson.scm.subversion.UpdaterException: failed to perform svn update
    ... 17 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: E175002: OPTIONS /svn/project failed
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:379)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:364)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:352)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:708)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:628)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:103)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1018)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.getRepositoryUUID(DAVRepository.java:148)
    at org.tmatesoft.svn.core.internal.wc2.SvnRepositoryAccess.createRepository(SvnRepositoryAccess.java:106)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgRepositoryAccess.createRepository(SvnNgRepositoryAccess.java:210)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgAbstractUpdate.updateInternal(SvnNgAbstractUpdate.java:144)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgAbstractUpdate.update(SvnNgAbstractUpdate.java:76)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgUpdate.run(SvnNgUpdate.java:38)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgUpdate.run(SvnNgUpdate.java:18)
    at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
    at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:20)
    at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
    at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:291)
    at org.tmatesoft.svn.core.wc.SVNUpdateClient.doUpdate(SVNUpdateClient.java:311)
    at org.tmatesoft.svn.core.wc.SVNUpdateClient.doUpdate(SVNUpdateClient.java:291)
    at org.tmatesoft.svn.core.wc.SVNUpdateClient.doUpdate(SVNUpdateClient.java:387)
    at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:143)
    ... 16 more
Caused by: svn: E175002: OPTIONS /svn/project failed
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:154)
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:97)
    ... 38 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: E175002: OPTIONS request failed on '/svn/project'
svn: E175002: Received fatal alert: bad_record_mac
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:754)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:373)
    ... 37 more
Caused by: svn: E175002: OPTIONS request failed on '/svn/project'
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:208)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:752)
    ... 38 more
Caused by: svn: E175002: Received fatal alert: bad_record_mac
    at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:109)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:505)
    ... 38 more
Caused by: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1781)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1024)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1208)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:674)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:119)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.sendData(HTTPConnection.java:313)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPRequest.dispatch(HTTPRequest.java:168)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:460)
    ... 38 more

Initial research

At first I thought it had something to do with credentials or the Jenkins version, but checkout as the jenkins user from commandline did work. Also updating Jenkins did not resolve the issue.
Some research taught me that this problem only appears on Java 6 and is caused by the underlying SVNKit svn library used: 1, 2, 3 and 4.

The solution

In most posts the solution described is either upgrading the java version or by supplying an additional parameter at Jenkins startup to force SVNKit to work a bit differently. I do not know the exact effect it has
in SVNKit, but it does work. The Jenkins version I use on CentOS is started by a init-script in /etc/init.d/jenkins. I replaced the following line that starts Jenkins with:

JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"

With:

JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -Dsvnkit.http.sslProtocols="SSLv3" -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"

This solved the problem and allowed Jenkins to update normally.

Leave a Comment

Use git-svn for SVN repositories

Recently I came across the possibility to use git to access SVN repositories. Basically you use the command

git svn ...

to checkout a SVN repository. This is then stored locally on your hard drive and accessible as an ordinary git repository. Updating your local checkout is done by issuing

git svn rebase

committing the changes back to SVN is done easily by issuing a

git svn commit

command.

This solution looks a very nice solution for older code sources which are still using SVN. There are some ifs and buts of course, with one the biggest remarks that branching and merging from your git-svn checkout back to SVN is discouraged because of the very different nature in branching between git and svn.

Leave a Comment

Install SVN server under Apache on Debian

A very good and readable howto is available at http://www.howtoforge.com/debian_subversion_websvn. I have made some additional changes after following this guide. The guide requires you to manually add each repository manually to the dav_svn.conf file. It is possible to do this differently, in a VirtualHost configuration. Do not enable the lines in dav_svn.conf but add the following lines to your desired VirtualHost configuration, in this example with ServerName svn.example.com:

<Location>
    Deny from all
    Allow from 192.168
</Location>
<Location /svn>
    DAV svn
    SVNParentPath /var/svn/repository/
    SVNListParentPath on
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /var/www/svn.example.com/dav_svn.passwd
    Require valid-user
</Location>

In this configuration there are the following things to keep in mind:

  • The parent folder of my SVN repository is different than the mentioned guide, /var/svn-repos is changed to /var/svn/repository
  • Access to this repository is restricted to only a specific subnet (192.168.*.* which is my own local network) by the first Location directive
  • All repositories are accessible via _http://svn.example.com/svn/\[name of repository] . _The usernames and passwords are configured in the dav_svn.passwd file, generated with htpasswd -c _/var/www/svn.example.com/dav_svn.passwd _(do not forget to create the folder in /var/www).

Leave a Comment