Posterous theme by Cory Watilo

Avoiding aborted transactions when running a Mercurial server on IIS6

I recently had the need to setup a Mercurial server to run on an IIS6 server. I followed the guide, created by Jeremy Skinner, on how to set it up on IIS7 server. Obviously there are small deviations on how to set it up on IIS6 and IIS7, but they are minor things.

The setup was very easy and smooth thanks to Jeremy’s guide, but when I tried to pull the repository from the server I kept getting the following result after it had been working for about 5 minutes.

requesting all changesadding changesetsadding manifestsadding file changestransaction abort!rollback completedabort: premature EOF reading chunk (got 91303 bytes, expected 1542634)

I pretty much tried to fiddle with every setting I could think of in IIS6 to get around this problem, but with no success. That’s when I turned to my preferred online resource; Twitter. I linked to a StackOverflow question I created to describe the problem and almost immediately the awesome Steel Price stepped up and offered his services.

The problem turned out to be that there is a CGI script timeout of 5 minutes in IIS 6 (and below, not sure about 7) and this was what kept being hit. I was trying to pull a repository that was roughly 500 mb in size. To change the timeout value you have to have the IIS 6 Resource Kit installed.

Once installed, start the MetaBase Explorer utility and navigate to <your computer>\LM\W3SVC and locate the CGITimeout entry and change the value from the default 300 (5 minutes) to a higher value (I ended up using 20 minutes).

After changing the value I restarted IIS to make sure it was used by the server. Once this has been done everything worked like a charm!