Versions – “Waiting for transactions to finish”

Every time I try to quit Versions it pops up an alert and says “Waiting for transactions to finish”. The alert will stay on the screen until I force quit Versions. This makes every reboot or logout a painful process.

This has been driving me crazy for awhile now, so I looked into the problem and found a “solution”. While I can’t vouch that it will work for everyone, I wanted to share it in the hopes that it might work for some.

This is going to be long so that everyone can understand the cause and possible soutions.

The problem firsrt showed up when I started using SVN 1.5. I upgraded all my repositories on my linux and mac servers, and the mac server was working well, but the linux server would ocassionally just hang in Versions. As part of the 1.5 upgrade there are some caches that you can either prebuild or build as needed, so I assumed the slowness was just those caches slowly being updated.

That was until this morning when I had the problem with a brand new empty repository. I found that when Versions was running, access to the repository was slow even from the command line. But if I wasn’t running Versions, performance was lightning fast from the command line.

It turns our the problem is related to the way SVN 1.5 uses random numbers. On linux (and OS X), there are two sources of random numbers. One is /dev/random, and the other is /dev/urandom. /dev/random produces true cryptographically secure random numbers. If there isn’t enough entropy available it will hang waiting for secure random numbers to become available. urandom on the other hand will sacrafice cyrptographica quality and always produce random numbers.

Svnserve on my linux box uses /dev/random, and if the random numbers aren’t available it blocks until they are. This in turn leads to Versions blocking waiting for svnserve to respond, which will happen eventually as sources of entropy like network traffic occur.

The problem is compounded when you turn on “Show Updates from Repository”. For me this is the entire reason for having a program like Versions, so that I can keep track of what repositories I’m working with have experienced changes, so I can make sure my source stays up to date and that I’m aware of who is making what changes to the source.

The problem is that the SVN server doesn’t do much besides serve svn connections. So there isn’t much entropy available. Eventually /dev/random runs out of random numbers and svnserve will hang, causing Versions to hang. Versions should be a bit smarter about realizing that if a request isn’t critical (like say a commit or update) that it can just terminate the connection on quit.

The solution is to either rebuild the Apache Portable Runtime library that svnserve from source and change it to use /dev/random instead of /dev/urandom. This would need to be done on the server.

The other choice is to simply remove /dev/random and replace it with the equivalent of urandom. This will affect all programs running on the server.

The commands are not for the faint of heart and can easily render the box unusable if done improperly. These are for a Fedora Core 9 box, and won’t work on OSX or other platforms. The commands must be run as root.

rm /dev/random
mknod /dev/random c 1 9
chmod 666 /dev/random

For me, this has completely solved the problem of Versions hanging on quit, and I’m back to mostly happy with the product.

This entry was posted in Flotsam and Jetsam. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.
  • iChat Status