"File exists" error on upload pack file doing 'bzr branch' on Windows

Bug #587795 reported by Andrew Bennetts
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

Originally reported at <https://bugs.launchpad.net/bzr/+bug/139253/comments/20>, by Bo Thorsen (~bo.thorsen):

"""
I have been hit by this bug three times over the last month on Windows 7 64 bit with bzr 2.1.1 and python 2.6.5.

The first two times were with a shared repository version 1.9, tomorrows problem was with version 2a.

I have an automated build system running, which may have been killed during a bzr operation.

I don't think this was the case with the others, but with this one I hit a lock on a branch that I had to remove with bzr break-lock, and after that, I get:

C:\Users\bo\mp\mariadb>bzr branch lp:~maria-captains/maria/5.1-release 5.1-release
bzr: ERROR (ignored): 'file:///C:/Users/bo/mp/mariadb/.bzr/repository/upload/ifyfp443v9nszroaal9x.pack'
bzr: ERROR: File exists: u'C:/Users/bo/mp/mariadb/.bzr/repository/upload/ifyfp443v9nszroaal9x.pack': [Error 183] En fil,
 som allerede findes, kan ikke oprettes

Sorry about the Danish translations. The error 183 says "A file, that already exists, can't be created".

Maybe it's possible to reproduce the bug by checking out the repository multiple times and kill it each time - not ctrl-C it, but kill the process. And it might have to be on Windows.

Deleting the file in .bzr/repository/upload doesn't help. It complains about a new file on each run.
"""

This is pretty odd, as the filenames in the upload directory should be randomly chosen. Perhaps some pack_repo code is trying to create an already created file? It's also interesting that this doesn't seem to happen to all Windows users (otherwise we'd be inundated with reports about it), so perhaps there's some other factor involved, like a particular virus scanner?

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 587795] [NEW] "File exists" error on upload pack file doing 'bzr branch' on Windows

A guess:
2a conversion finding two identical regions (odd but possible). If so
doing -r 1000 then pull -r 2000 until it errors, then doing a 'bzr
pack' and then continuing may help.

-Rob

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 587795] [NEW] "File exists" error on upload pack file doing 'bzr branch' on Windows

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bennetts wrote:
> Public bug reported:
>
> Originally reported at
> <https://bugs.launchpad.net/bzr/+bug/139253/comments/20>, by Bo Thorsen
> (~bo.thorsen):
>
> """
> I have been hit by this bug three times over the last month on Windows 7 64 bit with bzr 2.1.1 and python 2.6.5.
>
> The first two times were with a shared repository version 1.9, tomorrows
> problem was with version 2a.
>
> I have an automated build system running, which may have been killed
> during a bzr operation.
>
> I don't think this was the case with the others, but with this one I hit
> a lock on a branch that I had to remove with bzr break-lock, and after
> that, I get:
>
> C:\Users\bo\mp\mariadb>bzr branch lp:~maria-captains/maria/5.1-release 5.1-release
> bzr: ERROR (ignored): 'file:///C:/Users/bo/mp/mariadb/.bzr/repository/upload/ifyfp443v9nszroaal9x.pack'
> bzr: ERROR: File exists: u'C:/Users/bo/mp/mariadb/.bzr/repository/upload/ifyfp443v9nszroaal9x.pack': [Error 183] En fil,
> som allerede findes, kan ikke oprettes
>
> Sorry about the Danish translations. The error 183 says "A file, that
> already exists, can't be created".
>
> Maybe it's possible to reproduce the bug by checking out the repository
> multiple times and kill it each time - not ctrl-C it, but kill the
> process. And it might have to be on Windows.
>
> Deleting the file in .bzr/repository/upload doesn't help. It complains about a new file on each run.
> """
>
> This is pretty odd, as the filenames in the upload directory should be
> randomly chosen. Perhaps some pack_repo code is trying to create an
> already created file? It's also interesting that this doesn't seem to
> happen to all Windows users (otherwise we'd be inundated with reports
> about it), so perhaps there's some other factor involved, like a
> particular virus scanner?

Almost definitely this is caused by a crashing pull that managed to move
the content into .bzr/repository/packs but failed to add it to
.bzr/repository/pack-names

Unfortunately, the windows error only gives you 1 name, the source, when
what you actually care about is the collision on the destination.

I believe Martin just merged a patch to use a custom 'rename' that
raises an exception with both names (from and to), so that we can get
better error messages at least.

Some things to resolve/workaround the issue:

1) do a partial pull 'bzr pull -r -2'. This should create content that
is different than what you already pulled, and thus succeed the final
rename.

2) use 'bzr dump-btree [--raw] .bzr/repository/pack-names' and compare
the entries there to 'ls .bzr/repository/packs', you can remove any
files that aren't listed in pack-names.

I believe we have an open bug that if we get a collision in a pack
filename, what we would like to do is verify the content, and then just
use it.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwPuP8ACgkQJdeBCYSNAANcAwCgrMRVGT5L6Ol4aMmD2t2/UYiM
6okAnRQA24guX+Zakf9jplLzdI3yboUY
=PiuB
-----END PGP SIGNATURE-----

Revision history for this message
Paul Pelzl (pelzlpj) wrote :
Download full text (4.4 KiB)

This looks very much like the bug I see on a regular basis. I'm using Windows XP, bzr 2.2.1, and a pack-0.92 repository. On occasion when I "bzr pull" to bring in changes from other developers, I get this:

-----
Using saved parent location: N:/bzr/main/code/
bzr: ERROR (ignored): 'file:///C:/Tableau/.bzr/repository/upload/aphtssjcbh20hqj6xeuv.pack'
bzr: ERROR: File exists: u'C:/Tableau/.bzr/repository/upload/aphtssjcbh20hqj6xeuv.pack': [Error 183]
 Cannot create a file when that file already exists
-----

The log shows the following:

-----
Thu 2011-01-27 11:16:11 -0600
0.078 bazaar version: 2.2.1
0.078 bzr arguments: [u'pull']
0.094 looking for plugins in C:/Documents and Settings/paul.pelzl/Application Data/bazaar/2.0/plugins
0.141 looking for plugins in C:/Program Files/Bazaar/plugins
0.172 encoding stdout as sys.stdout encoding 'cp437'
0.187 opening working tree 'C:/Tableau/code'
0.219 Using fetch logic to copy between KnitPackRepository('file:///N:/bzr/main/.bzr/repository/')(RepositoryFormatKnitPack1()) and KnitPackRepository('file:///C:/tableau/.bzr/repository/')(RepositoryFormatKnitPack1())
0.219 fetch up to rev {XXXXX-20110127163948-g6asivbohg2lsy0g}
1.312 Using fetch logic to copy between KnitPackRepository('file:///N:/bzr/main/.bzr/repository/')(RepositoryFormatKnitPack1()) and KnitPackRepository('file:///C:/Tableau/.bzr/repository/')(RepositoryFormatKnitPack1())
1.312 fetch up to rev {XXXXX-20110127163948-g6asivbohg2lsy0g}
1.781 abort_write_group failed
1.781 Traceback (most recent call last):
  File "bzrlib\repository.pyo", line 978, in abort_write_group
  File "bzrlib\repofmt\pack_repo.pyo", line 2292, in _abort_write_group
  File "bzrlib\repofmt\pack_repo.pyo", line 2107, in _abort_write_group
  File "bzrlib\cleanup.pyo", line 135, in run_simple
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\repofmt\pack_repo.pyo", line 439, in abort
  File "bzrlib\transport\__init__.pyo", line 240, in close
KeyError: 'file:///C:/Tableau/.bzr/repository/upload/aphtssjcbh20hqj6xeuv.pack'

[ 4748] 2011-01-27 11:16:13.262 INFO: bzr: ERROR (ignored): 'file:///C:/Tableau/.bzr/repository/upload/aphtssjcbh20hqj6xeuv.pack'
1.797 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 912, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1112, in run_bzr
  File "bzrlib\commands.pyo", line 690, in run_argv_aliases
  File "bzrlib\commands.pyo", line 705, in run
  File "bzrlib\cleanup.pyo", line 135, in run_simple
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\builtins.pyo", line 1040, in run
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\workingtree.pyo", line 1622, in pull
  File "bzrlib\branch.pyo", line 1068, in pull
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\branch.pyo", line 3416, in pull
  File "bzrlib\branch.pyo", line 3525, in _pull
  File "bzrlib\branch.pyo", line 1017, in update_revisions
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\branch.pyo", line 3370, in update_revisions
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\branch.pyo", line...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.