Crash while trying to commit (bzrlib.errors.KnitCorrupt: Knit corrupt: incorrect number of lines for version ...)

Bug #281705 reported by mati
0
Affects Status Importance Assigned to Milestone
Bazaar
Incomplete
High
Unassigned

Bug Description

Error occured while trying to commit the first revision of my local project (~300mb) in bazaar 1.7.1 (the same was in 1.3).

Output:
(...)
added www/statystyka/usage_200810.html
added www/statystyka/webalizer.current
added www/statystyka/webalizer.hist
bzr: ERROR: bzrlib.errors.KnitCorrupt: Knit <bzrlib.knit.KnitVersionedFiles object at 0x87e1a2c> corrupt: incorrect number of lines 17800 != 17789 for version {mati@mati-desktop-20081010222145-mrjuvru4o34eqdv5} ['<inventory format="5" revision_id="mati@mati-desktop-20081010222145-mrjuvru4o34eqdv5">\n', '<file executable="yes" file_id="biznesplan.gnumeric-20081010220641-8knopd2qshq2xb7x-1" name="Biznesplan.gnumeric" revision="mati@mati-desktop-20081010222145-mrjuvru4o34eqdv5" text_sha1="6653b88c840f2e9badfb02d3fab70f6c1225b57b" text_size="2935" />\n', (... lots of these ...), '<file file_id="test.php-20081010220641-8knopd2qshq2xb7x-121" name="test.php" parent_id="www-20081010220641-8knopd2qshq2xb7x-10" revision="mati@mati-desktop-20081010222145-mrjuvru4o34eqdv5" text_sha1="3fbddfd9ae27c8194633b73f5b6fa3656a0bc9b2" text_size="158" />\n', '</inventory>\n']

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 2321, in run
    exclude=safe_relpath_files(tree, exclude))
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 242, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 197, in commit
    revprops=revprops, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commit.py", line 384, in commit
    self.rev_id = self.builder.commit(self.message)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 140, in commit
    self.new_inventory, self._config)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 616, in add_revision
    rev.inventory_sha1 = self.inventories.get_sha1s([key])[key]
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1243, in get_sha1s
    record_map = self._get_record_map(missing, allow_missing=True)
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1116, in _get_record_map
    self._read_records_iter(records):
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1564, in _read_records_iter
    content, digest = self._parse_record(key[-1], data)
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1492, in _parse_record
    rec, record_contents = self._parse_record_unchecked(data)
  File "/usr/lib/python2.5/site-packages/bzrlib/knit.py", line 1531, in _parse_record_unchecked
    rec[1], record_contents))

bzr 1.7.1 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'commit', '-m', 'Z wgranym, ale nieu\xc5\xbcywanym minified. Wy\xc5\x9bwietlanie drzewka w pe\xc5\x82nej wersji, z pustymi kategoriami.']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'pl_PL.UTF-8'
plugins:
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.95.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/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.

It has different traceback than #160081, so probably that's not a dupe.

Revision history for this message
mati (mati-wroc) wrote :

Still an issue in 1.8 - can't commit my first revision.

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

"incorrect number of lines" while reading an inventory knit strongly suggests that this is likely to be a duplicate of, or at least related to, bug 3918. Can you take a look at the XML in the error message and see if there appears to be a newline somewhere inside an attribute, e.g.

name="foo
bar"

?

Also, just to be clear, by "commit the first revision" you mean this is a completely new bzr branch (e.g. "bzr init; bzr add; bzr commit") with no prior revision history? I ask because some earlier versions of bzr, depending on how they were installed, might generate and save inventory XML that causes this error when read back in — but current versions should trigger a more appropriate error than KnitCorrupt, and they should trigger it before the invalid inventory XML gets written to disk. So it's surprising that you're reporting a KnitCorrupt here with 1.7.1.

In the meantime I'm marking this as High priority, as KnitCorrupt errors are very alarming.

Changed in bzr:
importance: Undecided → High
status: New → Incomplete
Revision history for this message
mati (mati-wroc) wrote :

> see if there appears to be a newline somewhere inside an attribute
There are no newline characters there, this is just 2764253-character-long-line (according to vim). There is no file with a newline in its name in this project.

> bzr init; bzr add; bzr commit
That's correct, except that I added some commit message:
bzr commit -m "Z wgranym, ale nieużywanym minified. Wyświetlanie drzewka w pełnej wersji, z pustymi kategoriami."

> So it's surprising that you're reporting a KnitCorrupt here with 1.7.1.
It's there even with 1.8 from PPA. I deleted .bzr directory before the try, as always.

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: [Bug 281705] Re: Crash while trying to commit (bzrlib.errors.KnitCorrupt: Knit corrupt: incorrect number of lines for version ...)

mati wrote:
> > see if there appears to be a newline somewhere inside an attribute
> There are no newline characters there, this is just
> 2764253-character-long-line (according to vim). There is no file with a
> newline in its name in this project.

Sorry, I was a bit confused! The error output is a Python repr() of the string,
so a newline will be displayed as “\n” rather than a visual line break in the
error output.

I'd be happy to inspect the XML for you, if you wish. Upload the full error
output as an attachment, or mail it directly to me at andrew.bennetts (at)
canonical.com.

> > bzr init; bzr add; bzr commit
> That's correct, except that I added some commit message:
> bzr commit -m "Z wgranym, ale nieużywanym minified. Wyświetlanie drzewka w pełnej wersji, z pustymi kategoriami."
>
> > So it's surprising that you're reporting a KnitCorrupt here with 1.7.1.
> It's there even with 1.8 from PPA. I deleted .bzr directory before the try, as always.

Ok, thanks for confirming that. Interesting!

Revision history for this message
mati (mati-wroc) wrote :

I investigated the project tree manually and indeed, there were 2 files with newlines in its names. So that's a dupe you were talking about, thanks for assistance!

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.