Project

General

Profile

Actions

Bug #5662

open

Full text search not working due to crash in whoosh

Added by Ben Allan over 3 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
03.06.2021
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

Full text search isn't working for us, due to the following crash:

2021-06-03 11:27:30.145 [14690] ERROR [rhodecode.config.middleware] error occurred handling this request for path: /_admin/search
Traceback (most recent call last):
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/tweens.py", line 41, in excview_tween
    response = handler(request)
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/router.py", line 148, in handle_request
    registry, request, context, context_iface, view_name
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/view.py", line 667, in _call_view
    response = view_callable(context, request)
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/config/views.py", line 188, in attr_view
    return view(context, request)
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/config/views.py", line 214, in predicate_wrapper
    return view(context, request)
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/viewderivers.py", line 436, in rendered_view
    result = view(context, request)
  File "/opt/rhodecode/store/da2il1f83gci4333j0sd256nji9nlhpa-python2.7-pyramid-1.10.4/lib/python2.7/site-packages/pyramid/viewderivers.py", line 132, in _class_view
    response = getattr(inst, attr)()
  File "/opt/rhodecode/store/5vmp7ipy3w2m4qii4fymlz8amzc9xd3k-python2.7-rhodecode-enterprise-ce-4.23.2/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 2507, in local_wrapper
    return wrapper(func, *args, **kwds)
  File "/opt/rhodecode/store/5vmp7ipy3w2m4qii4fymlz8amzc9xd3k-python2.7-rhodecode-enterprise-ce-4.23.2/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1823, in __wrapper
    return func(*fargs, **fkwargs)
  File "/opt/rhodecode/store/5vmp7ipy3w2m4qii4fymlz8amzc9xd3k-python2.7-rhodecode-enterprise-ce-4.23.2/lib/python2.7/site-packages/rhodecode/apps/search/views.py", line 138, in search
    perform_search(self.request, c)
  File "/opt/rhodecode/store/5vmp7ipy3w2m4qii4fymlz8amzc9xd3k-python2.7-rhodecode-enterprise-ce-4.23.2/lib/python2.7/site-packages/rhodecode/apps/search/views.py", line 39, in perform_search
    searcher = searcher_from_config(request.registry.settings)
  File "/opt/rhodecode/store/5vmp7ipy3w2m4qii4fymlz8amzc9xd3k-python2.7-rhodecode-enterprise-ce-4.23.2/lib/python2.7/site-packages/rhodecode/lib/index/__init__.py", line 151, in searcher_from_config
    searcher = imported.Searcher(config=_config)
  File "/opt/rhodecode/store/5vmp7ipy3w2m4qii4fymlz8amzc9xd3k-python2.7-rhodecode-enterprise-ce-4.23.2/lib/python2.7/site-packages/rhodecode/lib/index/whoosh.py", line 74, in __init__
    if exists_in(self.config['location'], indexname=FILE_INDEX_NAME):
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/index.py", line 136, in exists_in
    ix = open_dir(dirname, indexname=indexname)
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/index.py", line 123, in open_dir
    return FileIndex(storage, schema=schema, indexname=indexname)
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/index.py", line 421, in __init__
    TOC.read(self.storage, self.indexname, schema=self._schema)
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/index.py", line 632, in read
    check_size("int", _INT_SIZE)
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/index.py", line 626, in check_size
    sz = stream.read_varint()
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/filedb/structfile.py", line 191, in read_varint
    return read_varint(self.read)
  File "/opt/rhodecode/store/0cxfbx6hhh8kvfahjivy6i3y5703dm6b-python2.7-whoosh-2.7.4/lib/python2.7/site-packages/whoosh/util/varints.py", line 102, in read_varint
    b = ord(readfn(1))
TypeError: ord() expected a character, but string of length 0 found

We've upgraded to 4.25.2 and tried clearing caches but still see the error. This means the search on the frontpage fails, we can't access the search settings page, and running the indexer from the command line also fails.
Does anyone know what might cause this? Is it a single problematic repo or file that can't be indexed properly?

Apologies if this isn't the right place to post this, the community support portal has an issue where it's returning 500 internal server errors right now.

Actions #1

Updated by Ben Allan over 2 years ago

In case anyone is checking this in future, I took a look at this again and was able to work around the problem.

We most likely had some sort of corruption in the indexes created by whoosh which caused the error above, but all my attempts to have re-create the index (e.g. rhodecode-index --force) or exclude repos from the index crashed at the same point in the code. So instead I:

  • Stopped the server
  • Deleted the content of the data/index folder
  • Restarted the server
  • Ran the indexer again

And it seems to be working now, so I think this ticket can be closed.

Actions

Also available in: Atom PDF