3826: Rebuilding search index fails

erik*****@gmai***** (Google Code) (Is this you? Claim this profile.)
What version are you running?
2.0.11


What's the URL of the page containing the problem?
N/A


What steps will reproduce the problem?
1. sudo -u www-data rb-site manage /var/www/reviewboard rebuild_index

What is the expected output? What do you see instead?
I expect the command to succeed, instead I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/rb-site", line 9, in <module>
    load_entry_point('ReviewBoard==2.0.11', 'console_scripts', 'rb-site')()
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.11-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1877, in main
    command.run()
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.11-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1806, in run
    site.run_manage_command(args[0], args[1:])
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.11-py2.7.egg/reviewboard/cmdline/rbsite.py", line 654, in run_manage_command
    execute_from_command_line([__file__, cmd] + params)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django_haystack-2.1.0-py2.7.egg/haystack/management/commands/rebuild_index.py", line 15, in handle
    call_command('clear_index', **options)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/management/__init__.py", line 159, in call_command
    return klass.execute(*args, **defaults)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django_haystack-2.1.0-py2.7.egg/haystack/management/commands/clear_index.py", line 49, in handle
    backend.clear()
  File "/usr/local/lib/python2.7/dist-packages/django_haystack-2.1.0-py2.7.egg/haystack/backends/whoosh_backend.py", line 227, in clear
    self.setup()
  File "/usr/local/lib/python2.7/dist-packages/django_haystack-2.1.0-py2.7.egg/haystack/backends/whoosh_backend.py", line 121, in setup
    self.index = self.storage.open_index(schema=self.schema)
  File "/usr/local/lib/python2.7/dist-packages/Whoosh-2.6.0-py2.7.egg/whoosh/filedb/filestore.py", line 176, in open_index
    return indexclass(self, schema=schema, indexname=indexname)
  File "/usr/local/lib/python2.7/dist-packages/Whoosh-2.6.0-py2.7.egg/whoosh/index.py", line 421, in __init__
    TOC.read(self.storage, self.indexname, schema=self._schema)
  File "/usr/local/lib/python2.7/dist-packages/Whoosh-2.6.0-py2.7.egg/whoosh/index.py", line 632, in read
    check_size("int", _INT_SIZE)
  File "/usr/local/lib/python2.7/dist-packages/Whoosh-2.6.0-py2.7.egg/whoosh/index.py", line 626, in check_size
    sz = stream.read_varint()
  File "/usr/local/lib/python2.7/dist-packages/Whoosh-2.6.0-py2.7.egg/whoosh/filedb/structfile.py", line 191, in read_varint
    return read_varint(self.read)
  File "/usr/local/lib/python2.7/dist-packages/Whoosh-2.6.0-py2.7.egg/whoosh/util/varints.py", line 102, in read_varint
    b = ord(readfn(1))
TypeError: ord() expected a character, but string of length 0 found

What operating system are you using? What browser?
Ubuntu 12.04
#1 erik*****@gmai***** (Google Code) (Is this you? Claim this profile.)
I assume this bug isn't very helpful since you would probably like to see the data in the existing index (as would I) but I am not familiar with whoosh or haystack at all so I'll need some pointers on where to start.
#2 erik*****@gmai***** (Google Code) (Is this you? Claim this profile.)
I blew away all the files in the search directory and re-ran the rebuild_index command and this time it worked. I still have the bad files if we would like to analyze.
david
#3 david

I suspect it was just some file corruption. We haven't seen any other reports of this so I'm going to assume it's not really a bug.

  • -New
    +NotABug
#4 jflambert

Encountered this problem myself (after upgrading from 2.5.9 to 2.5.16). Flushed the search-index folder, rebuilt the index and the problem was gone.