MemoryError in _dirstate_helpers_c.Reader.get_next_str

Bug #252445 reported by David C. Petty
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Undecided
Unassigned

Bug Description

# I broke a lock and was attempting an update, then this happened:

V:\work\dev>bzr break-lock -v
Break lock file:///V:/work/dev/.bzr/checkout/lock
held by WHOMEVER on host monk [process #7368]
locked 3 hours, 28 minutes ago? [y/n]: y

V:\work\dev>bzr update v:\work\dev
bzr: ERROR: exceptions.MemoryError:

Traceback (most recent call last):
  File "bzrlib\commands.pyc", line 802, in run_bzr_catch_errors
  File "bzrlib\commands.pyc", line 758, in run_bzr
  File "bzrlib\commands.pyc", line 492, in run_argv_aliases
  File "bzrlib\builtins.pyc", line 1050, in run
  File "bzrlib\workingtree.pyc", line 2140, in update
  File "bzrlib\mutabletree.pyc", line 51, in tree_write_locked
  File "bzrlib\workingtree.pyc", line 2172, in _update_tree
  File "bzrlib\workingtree_4.pyc", line 1565, in _get_inventory
  File "bzrlib\workingtree_4.pyc", line 1424, in _generate_inventory
  File "bzrlib\dirstate.pyc", line 1877, in _read_dirblocks_if_needed
  File "_dirstate_helpers_c.pyx", line 694, in _dirstate_helpers_c._read_dirblocks_c
  File "_dirstate_helpers_c.pyx", line 661, in _dirstate_helpers_c.Reader._parse_dirblocks
  File "_dirstate_helpers_c.pyx", line 608, in _dirstate_helpers_c.Reader._get_entry
  File "_dirstate_helpers_c.pyx", line 502, in _dirstate_helpers_c.Reader.get_next_str
MemoryError

bzr 1.0.0 on python 2.5.1.final.0 (win32)
arguments: ['bzr', 'update', 'v:\\work\\dev']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  launchpad C:\dev\Bazaar\lib\library.zip\bzrlib\plugins\launchpad [unknown]
  multiparent C:\dev\Bazaar\lib\library.zip\bzrlib\plugins\multiparent.pyc [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 252445] [NEW] "bzr: ERROR: exceptions.MemoryError:" requested post

On Mon, 2008-07-28 at 02:03 +0000, David C. Petty wrote:
> Public bug reported:
>
> # I broke a lock and was attempting an update, then this happened:
>
> V:\work\dev>bzr break-lock -v
> Break lock file:///V:/work/dev/.bzr/checkout/lock
> held by WHOMEVER on host monk [process #7368]
> locked 3 hours, 28 minutes ago? [y/n]: y
>
> V:\work\dev>bzr update v:\work\dev
> bzr: ERROR: exceptions.MemoryError:

> File "_dirstate_helpers_c.pyx", line 502, in _dirstate_helpers_c.Reader.get_next_str
> MemoryError
>
> bzr 1.0.0 on python 2.5.1.final.0 (win32)

We have seen this with a corrupt dirstate file. The problem is that the
error reporting from the C accelerator is, well, brief.

Could you move _dirstate_helpers_c.so out of the way, and then try
again? It will still fail but we'll get a better error. We can then see
if its a fixed bug, local data issue etc and talk about how to get you
going again.

-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Revision history for this message
David C. Petty (o-launchpad-patton-petty-net) wrote : Re: "bzr: ERROR: exceptions.MemoryError:" requested post

# Is this what you were looking for? What / where is the dirstate file? And thank you for interest in my problem.

E:\work\bzr>bzr update v:\work\dev
bzr: ERROR: exceptions.TypeError: not enough arguments for format string

Traceback (most recent call last):
  File "bzrlib\commands.pyc", line 846, in run_bzr_catch_errors
  File "bzrlib\commands.pyc", line 797, in run_bzr
  File "bzrlib\commands.pyc", line 499, in run_argv_aliases
  File "bzrlib\builtins.pyc", line 1093, in run
  File "bzrlib\workingtree.pyc", line 2093, in update
  File "bzrlib\mutabletree.pyc", line 52, in tree_write_locked
  File "bzrlib\workingtree.pyc", line 2125, in _update_tree
  File "bzrlib\workingtree_4.pyc", line 1623, in _get_inventory
  File "bzrlib\workingtree_4.pyc", line 1479, in _generate_inventory
  File "bzrlib\dirstate.pyc", line 1963, in _read_dirblocks_if_needed
  File "bzrlib\_dirstate_helpers_py.pyc", line 205, in _read_dirblocks_py
TypeError: not enough arguments for format string

bzr 1.5 on python 2.5.2 (win32)
arguments: ['bzr', 'update', 'v:\\work\\dev']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  launchpad C:\dev\Bazaar\plugins\launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 252445] Re: "bzr: ERROR: exceptions.MemoryError:" requested post

On Mon, 2008-07-28 at 06:34 +0000, David C. Petty wrote:
> # Is this what you were looking for? What / where is the dirstate file?
> And thank you for interest in my problem.

The dirstate file is a binary file representing the current state of
your working directory. It is found in .bzr/checkout/dirstate.

> E:\work\bzr>bzr update v:\work\dev
> bzr: ERROR: exceptions.TypeError: not enough arguments for format string
>
> Traceback (most recent call last):
...
> File "bzrlib\_dirstate_helpers_py.pyc", line 205, in _read_dirblocks_py
> TypeError: not enough arguments for format string
>
> bzr 1.5 on python 2.5.2 (win32)

As far as I can tell there is a bug blocking the diagnosis of your
file :(.

Perhaps you could attach the dirstate file? It contains the filenames &
ids of the contents of your tree, but no personal data beyond that.

-Rob

--
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: "bzr: ERROR: exceptions.MemoryError:" requested post

David,

Thanks, that is the traceback Robert was asking for. You can find the dirstate file in .bzr/checkout/dirstate in the root of the working tree.

The traceback is actually tripping over a broken assertion:

    if trailing != '':
        raise AssertionError("dirstate line %r has trailing garbage: %r"
            % (trailing,))

(I'll submit a trivial fix for this dud AssertionError)

But that does at least tell us that bzr does think the file is corrupt.

Revision history for this message
David C. Petty (o-launchpad-patton-petty-net) wrote :

> if trailing != '':
> raise AssertionError("dirstate line %r has trailing garbage: %r"
> % (trailing,))

Before posting the dirstate file in a public forum, I thought I could fix this code and, perhaps, get a better error message, but I cannot find that code in Bazaar. It is not at: 'File "bzrlib\_dirstate_helpers_py.pyc", line 205, in _read_dirblocks_py'. Can you point me to the offending code?

Revision history for this message
Andrew Bennetts (spiv) wrote :

If you used the windows installer, I think bzrlib is kept in a single zip file somewhere.

That broken AssertionError is now fixed in bzr.dev though, so you could try making a checkout of <http://bazaar-vcs.org/bzr/bzr.dev> and running that.

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

I think this was fixed in a later release. If you can still reproduce this problem, please reopen it.

Changed in bzr:
status: New → Fix Released
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.