[Bug 721163] Re: bzr crashed with ErrorFromSmartServer: ('error', 'bytes must be a string')

John A Meinel john at arbash-meinel.com
Tue Jul 26 11:40:37 UTC 2011


I think I have an idea how this is happening. I don't have a great way
to prove it.

1) I think it requires having a lot of files/directories, such that the inventory pages have multiple levels.
2) It requires that something about the 'interesting' filter is causing some of the sub-tree pages to not get loaded. (Which if you have an incremental pull in a large tree, it is expected that some of the sub-sets won't get touched.)
3) It doesn't have anything to do with _chk_map_pyx.pyx specifically. It has to do with getting data that wasn't expected.

I'll try to document the program flow, because it is a bit confusing
with nested generators.

_get_filtered_chk_streams(...):
  _filter_id_to_entry()
    interesting_nodes = chk_map.iter_interesting_nodes(chk_bytes,
      self._chk_id_roots, uninteresting_root_keys)
    for record in _filter_text_keys(interesting_nodes, self._text_keys,
        chk_map._bytes_to_text_key):
        if record is not None:
            yield record


and in _filter_text_keys:
def _filter_text_keys(interesting_nodes_iterable, text_keys, bytes_to_text_key):
    """Iterate the result of iter_interesting_nodes, yielding the records
    and adding to text_keys.
    """
    text_keys_update = text_keys.update
    for record, items in interesting_nodes_iterable:
        text_keys_update([bytes_to_text_key(b) for n,b in items])
        yield record


The key parts is that for every node yielded by "iter_interesting_nodes", we
expect it to be a tuple of (record, items). And then for the items themselves,
we expect them to be tuples of name, bytes.

The yielder code looks like:

    def process(self):
        for record in self._read_all_roots():
            yield record, []
        for record, items in self._process_queues():
            yield record, items

The idea is that for InternalNode objects, they should *not* have any items,
and for LeafNode objects, they should have items of the appropriate form.


What it appears to be is that we are getting some items which are in the form
"n,b" but that "b" is not a simple string, but a tuple.

The code that grabs items is in "_read_nodes_from_store(refs)": which looks
like:

def _read_nodes_from_store(self, keys):
    ...
    for record in stream:
        ...
        bytes = record.get_bytes_as('fulltext')
        node = _deserialise(bytes, record.key,
                            search_key_func=self._search_key_func)
        if type(node) is InternalNode:
            # Note we don't have to do node.refs() because we know that
            # there are no children that have been pushed into this node
            ...
            prefix_refs = node._items.items()
            items = []
        else:
            prefix_refs = []
            ...
            items = node._items.items()
        yield record, node, prefix_refs, items


Looking at that, we force items to be an empty list if it is an InternalNode.
So this has to be happening on a LeafNode.

Looking at the code parser for LeafNodes, the 'key' portion is rather complex,
but we have:
    value = PyString_FromStringAndSize(value_start, next_line - value_start)
    ...
    entry_bits = StaticTuple_Intern(entry_bits)
    PyDict_SetItem(items, entry_bits, value)

So I can't see how value could be anything other than a String.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bzr in Ubuntu.
https://bugs.launchpad.net/bugs/721163

Title:
  bzr crashed with ErrorFromSmartServer: ('error', 'bytes must be a
  string')

Status in Bazaar Version Control System:
  Incomplete
Status in “bzr” package in Ubuntu:
  Invalid

Bug description:
  Binary package hint: bzr

  bzr: failed to report crash using apport:et stream source                                                                                                   
       OSError(17, 'File exists')
  bzr: ERROR: bzrlib.errors.ErrorFromSmartServer: Error received from smart server: ('error', 'bytes must be a string')

  ProblemType: Crash
  DistroRelease: Ubuntu 10.10
  Package: bzr 2.2.1-0ubuntu1
  ProcVersionSignature: Ubuntu 2.6.35-25.44-generic 2.6.35.10
  Uname: Linux 2.6.35-25-generic i686
  Architecture: i386
  BzrDebugFlags: set()
  BzrVersion: 2.2.1
  CommandLine: ['/usr/bin/bzr', 'push', 'bzr+http://node09:8081/code/xalo-news/fastesp/trunk']
  CrashDb: bzr
  Date: Fri Feb 18 16:46:51 2011
  ExecutablePath: /usr/bin/bzr
  FileSystemEncoding: UTF-8
  InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
  InterpreterPath: /usr/bin/python2.6
  Locale: en_US.utf8
  Platform: Linux-2.6.35-25-generic-i686-with-Ubuntu-10.10-maverick
  ProcCmdline: /usr/bin/python /usr/bin/bzr push bzr+http://node09:8081/code/xalo-news/fastesp/trunk
  ProcEnviron:
   SHELL=/bin/bash
   PATH=(custom, user)
   LANG=en_US.utf8
  PythonVersion: 2.6.6
  SourcePackage: bzr
  Title: bzr crashed with ErrorFromSmartServer in _translate_error()
  UserEncoding: UTF-8
  UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

  Traceback (most recent call last):
    File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 912, in exception_to_return_code
      return the_callable(*args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1112, in run_bzr
      ret = run(*run_argv)
    File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 690, in run_argv_aliases
      return self.run(**all_cmd_args)
    File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 705, in run
      return self._operation.run_simple(*args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 135, in run_simple
      self.cleanups, self.func, *args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
      result = func(*args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 1161, in run
      use_existing_dir=use_existing_dir)
    File "/usr/lib/python2.6/dist-packages/bzrlib/push.py", line 139, in _show_push_branch
      remember, create_prefix)
    File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1360, in push_branch
      overwrite, stop_revision=revision_id)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 1077, in push
      *args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 3439, in push
      _override_hook_source_branch=_override_hook_source_branch)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 3244, in _run_with_write_locked_target
      result = callable(*args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 3478, in _push_with_bound_branches
      stop_revision)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2642, in _basic_push
      overwrite=overwrite, graph=graph)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 1017, in update_revisions
      overwrite, graph)
    File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 194, in write_locked
      result = unbound(self, *args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 3370, in update_revisions
      self.target.fetch(self.source, stop_revision)
    File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 194, in write_locked
      result = unbound(self, *args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 673, in fetch
      pb=pb)
    File "/usr/lib/python2.6/dist-packages/bzrlib/remote.py", line 1380, in fetch
      find_ghosts=find_ghosts, fetch_spec=fetch_spec)
    File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 194, in write_locked
      result = unbound(self, *args, **kwargs)
    File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 3448, in fetch
      find_ghosts=find_ghosts)
    File "/usr/lib/python2.6/dist-packages/bzrlib/fetch.py", line 73, in __init__
      self.__fetch()
    File "/usr/lib/python2.6/dist-packages/bzrlib/fetch.py", line 99, in __fetch
      self._fetch_everything_for_search(search)
    File "/usr/lib/python2.6/dist-packages/bzrlib/fetch.py", line 127, in _fetch_everything_for_search
      stream, from_format, [])
    File "/usr/lib/python2.6/dist-packages/bzrlib/remote.py", line 1841, in insert_stream
      (verb, path, resume_tokens) + lock_args, byte_stream)
    File "/usr/lib/python2.6/dist-packages/bzrlib/smart/client.py", line 181, in call_with_body_stream
      expect_response_body=False)
    File "/usr/lib/python2.6/dist-packages/bzrlib/smart/client.py", line 81, in _call_and_read_response
      expect_body=expect_response_body),
    File "/usr/lib/python2.6/dist-packages/bzrlib/smart/message.py", line 306, in read_response_tuple
      _translate_error(self.args)
    File "/usr/lib/python2.6/dist-packages/bzrlib/smart/message.py", line 361, in _translate_error
      raise errors.ErrorFromSmartServer(error_tuple)
  ErrorFromSmartServer: Error received from smart server: ('error', 'bytes must be a string')

To manage notifications about this bug go to:
https://bugs.launchpad.net/bzr/+bug/721163/+subscriptions




More information about the foundations-bugs mailing list