Issue #386 new

KeyError: (<CompressedBytes.Reader>, 1L)

Anonymous created an issue


I've been having issues with whoosh in combination with django-haystack. About once a week, the website running haystack and whoosh keeps returning errors and filling our Sentry feeds with the following error:

whoosh.util.cache in wrapper KeyError: (<CompressedBytes.Reader>, 1L)

(1L changes, full stacktrace here: )

I was wondering if this is something that (could be) related to whoosh or our implementation of it. If you have any idea on how to fix this it would be very helpful.

Comments (11)

  1. manelclos

    Hi, because I was having the same problem "KeyError" on, I tested different versions from 2.4.1 to 2.6.0. If you reload the search page very fast, apache starts to spawn processes and searching on different tabs at the same time will (easily) catch the error. Here is the testing summary, in testing order:

    • ...
    • 2.5.2 FAIL (2.5.1 index)
    • 2.5.1 fail: harder to reproduce
    • 2.4.1 rebuild, OK
    • 2.5 ok
    • 2.5.1 ok, rebuild, fail
    • 2.5 fail, rebuild, fail
    • 2.4.1 rebuild, ok
    • 2.5 ok

    I was no able to reproduce the problem with 2.4.1, it looks the regression was introduced in 2.5. Also, I was not able to reproduce it in 2.5 with the 2.4.1 index, so it may be something related to the index construction.

    Can you try version 2.4.1 to see if you can reproduce the problem?

  2. Mattias Fliesberg

    I tried that patch but it doesn't work because I get the error in the lru_cache decorator but that one fixes random_cache. Everyone seems to be talking about getting it in lru_cache though so maybe that's just a mistake on the authors part?

  3. brainstorm

    I just applied the same changes to the function/lines affected and it seems to hold for now. Needs more testing and perhaps the searches become slower (lock strategy does not seem very optimal), but it is working for now :)

  4. Martin Cech

    Can confirm on 2.5.7. I am unable to reproduce when not overriding the final method of own Weighting class though. Might have something to do with it? No Django here, only nginx proxy. Downgrade to 2.4.1 seems to help (but re-introduces some fixed bugs so I had to build my own egg :( )

  5. Log in to comment