[darcs-devel] [issue996] changes => bug in darcs! (same URLs with different parameters) (2.0.2+74)

dmitry.kurochkin bugs at darcs.net
Tue Sep 9 07:22:02 UTC 2008


dmitry.kurochkin <dmitry.kurochkin at gmail.com> added the comment:

I have looked at the log. And here is my understanding of what is going on:

1. Darcs speculates on a patch.
2. urlThread gets to it, and puts into waitToStart queue.
3. urlThread starts downloading the patch, blocks in waitNextUrl.
4. Darcs calls copyUrl for the same patch. This puts download request into the
URL channel, but urlThread did not read it yet.
5. Darcs calls waitUrl for the patch.
6. Patch is successfully downloaded, urlThread unblocks, waitUrl unblocks.
7. urlThread reads the second request for the patch from the channel. Since the
previous URL is already removed from the map, a new download starts.
8. urlThread blocks in waitNextUrl and waiting for the patch to be downloaded
for the second time.
9. Darcs exits.

I am not sure what happens when haskell program exits. Looks like curl download
is interrupted but haskell code is still executed until renameFile is called
(and exception is thrown, since download is not complete and file does not exist
yet). Any comments if this makes sense?

Besides the fact that there is a (mystery) renameFile call, there is a race
condition that makes a patch downloaded twice. One solution for this would be
keeping map of all URLs we have downloaded. But I think this can have
performance impact if we have a huge repo... My proposal is to check if target
file exists before starting download. That will not help with the case when we
download to temporary files, but should work fine for patches. I will send a
patch for Eric to test.

Regards,
  Dmitry

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue996>
__________________________________


More information about the darcs-devel mailing list