empty limbo dirs cause error about left-over files

Bug #427773 reported by Alexander Belchenko
46
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Pool
2.0
Won't Fix
Medium
Unassigned
2.4
Fix Released
Medium
Martin Pool

Bug Description

bzr 1.18.1

On bzr pull I've got error about limbo. Then bzr status tells me that WT is out of date and I should run update. But update is also fails with the same limbo error.

C:\work\Bazaar\plugins\qbzr>bzr update
bzr: ERROR: This tree contains left-over files from a failed operation.
    Please examine C:/work/Bazaar/plugins/qbzr/.bzr/checkout/limbo to see if it contains any files you wish to
    keep, and delete it when you are done.

But limbo directory is empty. Why bzr blows up in this case???

C:\work\Bazaar\plugins\qbzr\.bzr\checkout\limbo>dir
 Volume in drive C is XP
 Volume Serial Number is B47B-BD42

 Directory of C:\work\Bazaar\plugins\qbzr\.bzr\checkout\limbo

31.08.2009 12:31 <DIR> .
31.08.2009 12:31 <DIR> ..
               0 File(s) 0 bytes
               2 Dir(s) 46 941 372 416 bytes free

The bad thing that first error leaves WT locked:

C:\work\Bazaar\plugins\qbzr>bzr update
Unable to obtain lock file:///C:/work/Bazaar/plugins/qbzr/.bzr/checkout/lock
held by <email address hidden> on host ten [process #2672]
locked 2 minutes, 37 seconds ago
Will continue to try until 12:45:07, unless you press Ctrl-C
If you're sure that it's not being modified, use bzr break-lock file:///C:/work/Bazaar/plugins/qbzr/.bzr/checkout/lock

I see there is 2 bugs:

1) Empty limbo dir should not prevent execution of operation.
2) limbo error leaves WT locked.

C:\work\Bazaar\plugins\qbzr>bzr info -v
Lightweight checkout (format: 1.6 or 1.6.1-rich-root or 1.9 or 1.9-rich-root or dirstate or dirstate-tags or pack-0.92 or rich-r
oot or rich-root-pack)
Location:
  light checkout root: .
   checkout of branch: C:/work/Bazaar/repos/qbzr-repo-1.9/trunk
    shared repository: C:/work/Bazaar/repos/qbzr-repo-1.9

Related branches:
    push branch: bzr+ssh://bazaar.launchpad.net/~qbzr-dev/qbzr/trunk/
  parent branch: bzr+ssh://bazaar.launchpad.net/~qbzr-dev/qbzr/trunk/
  submit branch: C:/work/Bazaar/repos/qbzr-repo-1.9/_REVIEW/qswitch

Format:
       control: Meta directory format 1
  working tree: Working tree format 4
        branch: Branch format 7
    repository: Packs 6 (uses btree indexes, requires bzr 1.9)

Lock status:
  working tree: locked
        branch: unlocked
    repository: unlocked

Working tree is out of date: missing 9 revisions.

In the working tree:
       199 unchanged
         0 modified
         0 added
         0 removed
         0 renamed
         1 unknown
       169 ignored
        13 versioned subdirectories

Branch history:
       959 revisions
      1104 days old
   first revision: Sun 2006-09-03 02:28:15 +0200
  latest revision: Thu 2009-09-10 22:41:55 +0200

Repository:
      1935 revisions

Related branches

Revision history for this message
Alexander Belchenko (bialix) wrote :

OK, there is 3 empty directories in .bzr/checkout:

empty limbo dir, empty pending-deletion dir, and empty shelf dir.

Removing only limbo does not help. Removing pending-deletion does help.

But in this case there is actually third bug:

3) Error message tell me about limbo dir, but actual problem was in pending-deletion dir.

Revision history for this message
Alexander Belchenko (bialix) wrote :

I think there is should be some command to remove all this limbo* junk from .bzr/checkout/

Changed in bzr:
status: New → Confirmed
summary: - empty limbo dir prevents to successful execution of bzr commands and
+ empty limbo dirs prevents to successful execution of bzr commands and
left working tree locked
Revision history for this message
Vincent Ladeuil (vila) wrote : Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

Right, limbo and pending_deletion are twins and should always be deleted together (IME).

But the bug is that you shouldn't ends up in that situation.
'bzr pull' is not supposed to left you in such a state, so if you can identify the faulty operation,
we can fix it.

If instead, you end up here while developing, say, a new to way to pull :-)
then may be you should fix that here :)

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

This is a dup of Bug 354012, but I have marked that as a dup of this because there seems to be more info in this bug.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Vincent, my answers:

> Right, limbo and pending_deletion are twins and should always be deleted together (IME).

Is it documented somewhere? Does this tip present in online help?
I was not aware of this.

> But the bug is that you shouldn't ends up in that situation.

But I am. And I don't know why.

> 'bzr pull' is not supposed to left you in such a state, so if you can identify the faulty operation,
we can fix it.

I don't know. I've not touched my qbzr mirror on that machine several days. As I see there was shelf. Maybe it's leftover after unshelve. I really don't know.

> If instead, you end up here while developing, say, a new to way to pull :-)
> then may be you should fix that here :)

No, it's just plain pull without any changes. Honestly.

Revision history for this message
Gary van der Merwe (garyvdm) wrote : Re: [Bug 427773] Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

This is easy to reproduce.

Steps to reproduce: in a branch that has some revisions:
cd .bzr/checkout
mkdir limbo
cd ../../
bzr pull . -r -2 --overwrite
bzr: ERROR: This tree contains left-over files from a failed operation.
    Please examine D:/test/.bzr/checkout/limbo to see if it contains
any files you wish to
    keep, and delete it when you are done.
rm .bzr/checkout/limbo -r
bzr pull . -r -2 --overwrite
Unable to obtain lock file:///D:/test/.bzr/branch/lock
held by <email address hidden> on host epsilon [process #2492]
locked 5 seconds ago
Will continue to try until 14:25:00, unless you press Ctrl-C
If you're sure that it's not being modified, use bzr break-lock
file:///D:/test/.bzr/branch/lock
bzr: interrupted

Here is the .bzr.log entry for the first bzr pull:

Fri 2009-09-11 14:19:54 +0200
0.079 bzr arguments: [u'pull', u'-r', u'-2', u'--overwrite']
0.094 looking for plugins in D:\My Documents\bzr-plugins
0.219 looking for plugins in C:/Program Files/Bazaar/plugins
0.219 Plugin name qbzr already loaded
0.266 encoding stdout as sys.stdout encoding 'cp437'
0.313 opening working tree 'D:/test'
0.438 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 835, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1030, in run_bzr
  File "bzrlib\commands.pyo", line 647, in run_argv_aliases
  File "bzrlib\builtins.pyo", line 1022, in run
  File "bzrlib\decorators.pyo", line 192, in write_locked
  File "bzrlib\workingtree.pyo", line 1626, in pull
  File "bzrlib\merge.pyo", line 1536, in merge_inner
  File "bzrlib\merge.pyo", line 508, in do_merge
  File "bzrlib\merge.pyo", line 480, in _do_merge_to
  File "bzrlib\merge.pyo", line 616, in do_merge
  File "bzrlib\transform.pyo", line 1298, in __init__
ExistingLimbo: This tree contains left-over files from a failed operation.
    Please examine D:/test/.bzr/checkout/limbo to see if it contains
any files you wish to
    keep, and delete it when you are done.

0.438 return code 3

I think that the real bug is that the branch is left locked. This is
odd, because bzrlib.tests.test_transform.TestTreeTransform.test_existing_limbo
specifically checks that it is not left locked.

Revision history for this message
Vincent Ladeuil (vila) wrote : Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

I trust you.

I don't think there is any documentation about the relationship between limbo and pending deletion, that is itself a bug.

Any hint in .bzr.log ?

I ended up in that situation more or less randomly months ago but I can't remember the details,
only that I was doing semi hackish things so I couldn't fully blame bzr and never reported the problems
(bad vila).

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

I think I have found the problem, and am preparing a patch.

Changed in bzr:
assignee: nobody → Gary van der Merwe (garyvdm)
Revision history for this message
Gary van der Merwe (garyvdm) wrote :

vila wrote on irc:
> your example in #427773 is bogus, what we care about is how we end up with a limbo dir :)
> oh, right, there is a cascading bug too
> but let's search the root cause anyway, this should never happen and identify a real problem

Ok - I'm trying to fix the cascading bug (which I experienced when my computer experienced a power failure while it was doing a merge.)

Changed in bzr:
importance: Undecided → Medium
milestone: none → 2.1
status: Confirmed → Fix Committed
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 427773] Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

Gary van der Merwe пишет:
> ** Changed in: bzr
> Status: Confirmed => Fix Committed
>
> ** Changed in: bzr
> Milestone: None => 2.1

Gary, if your fix is not API break, then I'd suggest to target it for
2.0.1 release. Because 2.1 will be release after 6 months.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

Vincent, Aaron:

I know how to reproduce my problem.

1) make the change to some file and run bzr shelve.
2) on first prompt of shelve command kill the bzr (without Ctrl+C)
3) As result there is 3 empty dirs in checkout: limbo, pending-deletion, shelf

Because limbo and pending-deletion directories are both EMPTY -- I don't think bzr should blow up as it doing today. It can delete or reuse them. Today the check is VERY VERY hard: presence of any of this dirs even if they're empty -- and you get the problem.

Why?

Revision history for this message
Martin Pool (mbp) wrote :

I'd be ok with a clean fix for this in 2.0.1

Revision history for this message
Gary van der Merwe (garyvdm) wrote : Re: [Bug 427773] Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

On Tue, Sep 15, 2009 at 3:48 AM, Martin Pool <email address hidden> wrote:
> I'd be ok with a clean fix for this in 2.0.1

https://code.launchpad.net/~garyvdm/bzr/427773-2.0-unlock-when-limbo/+merge/11631

Vincent Ladeuil (vila)
Changed in bzr:
status: Fix Committed → Fix Released
Vincent Ladeuil (vila)
Changed in bzr:
milestone: 2.1.0 → 2.1b1
Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 427773] Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

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

Alexander Belchenko wrote:
> Because limbo and pending-deletion directories are both EMPTY -- I don't
> think bzr should blow up as it doing today. It can delete or reuse them.
> Today the check is VERY VERY hard: presence of any of this dirs even if
> they're empty -- and you get the problem.
>
> Why?

Because the directories shouldn't be there at all. If you kill shelve
after you've shelved some changes, then the directories will be present
and have contents. Being present and empty is just a special case of
them being present.

Special handling makes bzr's behaviour less predictable, and I don't
think it should be done for rare failure modes.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrKSHAACgkQ0F+nu1YWqI0vAQCfZJD3oVDmlu7XF2hjrnLwNk/8
3loAn1XiQQ4R+JoAVfftoMPvjoZC7Ang
=U9p6
-----END PGP SIGNATURE-----

Revision history for this message
Vincent Ladeuil (vila) wrote : Re: empty limbo dirs prevents to successful execution of bzr commands and left working tree locked

I encountered limbo related errors more than a few times.

All the situations I can remember were with *both* directories empty.
I deleted them and went my way.

It sounds perfectly safe to either delete them or, more simply. less risky, reuse them.
The failure mode is not rare and easy to recognize (both dirs empty), the risk is nil, we should fix that.

Revision history for this message
Martin Pool (mbp) wrote :

der| reports this is still happening in 2.1.0b3

der|: the limbo and pending-deletion are empty correct
der|: poolie, maybe this helps: I was workign with a Photoshop PSD file, and I was trying to revert it with: bzr revert --no-backup -r5 home.psd, after that the limbo and the pending-deletion directories were conflicting

summary: - empty limbo dirs prevents to successful execution of bzr commands and
- left working tree locked
+ empty limbo dirs cause error about left-over files
Changed in bzr:
assignee: Gary van der Merwe (garyvdm) → nobody
milestone: 2.1.0b1 → none
status: Fix Released → Confirmed
Revision history for this message
Ernesto Méndez (der.kunstler) wrote :

bzr 2.1.0b3 on a Windows 7 system.

I was workign with a Photoshop PSD file, and I was trying to revert it with the following command:

bzr revert --no-backup -r5 home.psd

After that, bzr states the following:
bzr: ERROR: This tree contains left-over files from a failed operation.
    Please examine C:/Users/ernie/Desktop/gateway/.bzr/checkout/limbo to see if it contains any files you wish to
    keep, and delete it when you are done.

The 'limbo' and 'pending-deletion' files are empty. Also, when trying to revert the PSD file, Photoshop was open.

Changed in bzr:
status: Confirmed → Incomplete
Revision history for this message
Ernesto Méndez (der.kunstler) wrote :

Here's how to replicate the bug:

1- Create a file called home.psd with anything in it.
2- Save the file, then close Photoshop.
3- Open the file home.psd in Photoshop again.
4- Modify and Save the changes
5- execute the following command: bzr revert home.psd

After execution, the Error message is displayed. Something important though, the file is actually reverted but bzr displays the error message even when reverting the file. Maybe this error message shouldn't be displayed since it had successfully reverted the file.

Martin Pool (mbp)
Changed in bzr:
status: Incomplete → Confirmed
Revision history for this message
Amos Jeffries (yadi) wrote :

2.0 is still broken. Sighted again today in 2.0.2 latest Karmic version.

Revision history for this message
Vincent Ladeuil (vila) wrote :

The focus of this bug is a bit fuzzy, Gary's fix doesn't address accepting empty limbo and pending deletion dirs.

I think the discussion here have stated the problem and its fix quite clearly so I don't want to open a new bug for this.

Jelmer Vernooij (jelmer)
Changed in bzr:
status: Confirmed → Fix Released
Revision history for this message
Vincent Ladeuil (vila) wrote :

Re-opening as deleting empty limbo and pending-deletion dirs hasn't been implemented yet.

Changed in bzr:
status: Fix Released → Confirmed
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Should we reopen the 2.0 task of this as well?

Revision history for this message
Vincent Ladeuil (vila) wrote :

No.

Vincent Ladeuil (vila)
tags: added: treetransform
Revision history for this message
Martin Pool (mbp) wrote :

I know Gary did fix something useful here, but I think this actual bug as described is not fixed in 2.0, and since that series is now ancient and this is not a critical bug it is not going to be fixed, so I'm going to clear this up.

Changed in bzr:
status: Confirmed → In Progress
assignee: nobody → Martin Pool (mbp)
Revision history for this message
Martin Pool (mbp) wrote :

Fixed in lp:bzr/2.4; will be fixed in trunk when that is merged up.

Changed in bzr:
milestone: none → 2.5b4
Vincent Ladeuil (vila)
Changed in bzr:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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