jameslittle230 / stork

🔎 Impossibly fast web search, made for static sites.
https://stork-search.net
Apache License 2.0
2.73k stars 56 forks source link

Panic when importing indices built with excerpts_per_result == 0 #358

Open gber opened 1 year ago

gber commented 1 year ago

The documentation advises to set excerpts_per_result to 0 in order to save space:

If set to 0, the indexer will be able to optimize the search index filesize, making it up to 40% smaller.

Unfortunately, it seems that indices built that way cannot be imported again due to a panic in the rust library:

panicked at 'index out of bounds: the len is 0 but the index is 0', stork-lib/src/index_v3/search/entry_and_intermediate_excerpts.rs:94:46

Stack:

214/e/l.wbg.__wbg_new_693216e109162396@http://localhost:8000/script/stork.js:1:2409
@http://localhost:8000/script/stork.wasm:wasm-function[231]:0x3992d
@http://localhost:8000/script/stork.wasm:wasm-function[742]:0x46c03
@http://localhost:8000/script/stork.wasm:wasm-function[307]:0x3de0d
@http://localhost:8000/script/stork.wasm:wasm-function[389]:0x41600
@http://localhost:8000/script/stork.wasm:wasm-function[601]:0x460af
@http://localhost:8000/script/stork.wasm:wasm-function[510]:0x44a43
@http://localhost:8000/script/stork.wasm:wasm-function[579]:0x45c66
@http://localhost:8000/script/stork.wasm:wasm-function[457]:0x436e4
@http://localhost:8000/script/stork.wasm:wasm-function[157]:0x34412
@http://localhost:8000/script/stork.wasm:wasm-function[392]:0x417b9
@http://localhost:8000/script/stork.wasm:wasm-function[450]:0x43401
@http://localhost:8000/script/stork.wasm:wasm-function[78]:0x2afc1
@http://localhost:8000/script/stork.wasm:wasm-function[393]:0x4184a
@http://localhost:8000/script/stork.wasm:wasm-function[451]:0x43467
@http://localhost:8000/script/stork.wasm:wasm-function[33]:0x202cc
@http://localhost:8000/script/stork.wasm:wasm-function[210]:0x3833e
@http://localhost:8000/script/stork.wasm:wasm-function[267]:0x3bbee
@http://localhost:8000/script/stork.wasm:wasm-function[54]:0x26635
@http://localhost:8000/script/stork.wasm:wasm-function[116]:0x303d9
@http://localhost:8000/script/stork.wasm:wasm-function[380]:0x4104e
@http://localhost:8000/script/stork.wasm:wasm-function[296]:0x3d4dd
y@http://localhost:8000/script/stork.js:1:1669
139/t.resolveSearch@http://localhost:8000/script/stork.js:1:19389
934/e.prototype.performSearch@http://localhost:8000/script/stork.js:1:8182
771/e.prototype.handleInputEvent@http://localhost:8000/script/stork.js:1:14609
inputInputEvent@http://localhost:8000/script/stork.js:1:9709

stork.js:1:2623
    __wbg_error_09919627ac0992f5 http://localhost:8000/script/stork.js:1
    <anonymous> http://localhost:8000/script/stork.wasm:235948
    <anonymous> http://localhost:8000/script/stork.wasm:289795
    <anonymous> http://localhost:8000/script/stork.wasm:253453
    <anonymous> http://localhost:8000/script/stork.wasm:267776
    <anonymous> http://localhost:8000/script/stork.wasm:286895
    <anonymous> http://localhost:8000/script/stork.wasm:281155
    <anonymous> http://localhost:8000/script/stork.wasm:285798
    <anonymous> http://localhost:8000/script/stork.wasm:276196
    <anonymous> http://localhost:8000/script/stork.wasm:214034
    <anonymous> http://localhost:8000/script/stork.wasm:268217
    <anonymous> http://localhost:8000/script/stork.wasm:275457
    <anonymous> http://localhost:8000/script/stork.wasm:176065
    <anonymous> http://localhost:8000/script/stork.wasm:268362
    <anonymous> http://localhost:8000/script/stork.wasm:275559
    <anonymous> http://localhost:8000/script/stork.wasm:131788
    <anonymous> http://localhost:8000/script/stork.wasm:230206
    <anonymous> http://localhost:8000/script/stork.wasm:244718
    <anonymous> http://localhost:8000/script/stork.wasm:157237
    <anonymous> http://localhost:8000/script/stork.wasm:197593
    <anonymous> http://localhost:8000/script/stork.wasm:266318
    <anonymous> http://localhost:8000/script/stork.wasm:251101
    y http://localhost:8000/script/stork.js:1
    resolveSearch http://localhost:8000/script/stork.js:1
    performSearch http://localhost:8000/script/stork.js:1
    handleInputEvent http://localhost:8000/script/stork.js:1
    inputInputEvent http://localhost:8000/script/stork.js:1
StorkError: Could not parse data from wasm_search. If you see this, please file a bug: https://jil.im/storkbug null
    t http://localhost:8000/script/stork.js:1
    resolveSearch http://localhost:8000/script/stork.js:1
    performSearch http://localhost:8000/script/stork.js:1
    handleInputEvent http://localhost:8000/script/stork.js:1
    inputInputEvent http://localhost:8000/script/stork.js:1
stork.js:1:8334
    performSearch http://localhost:8000/script/stork.js:1
    handleInputEvent http://localhost:8000/script/stork.js:1
    inputInputEvent http://localhost:8000/script/stork.js:1
panicked at 'assertion failed: `(left == right)`
  left: `true`,
 right: `false`: cannot recursively acquire mutex', /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/wasm/../unsupported/locks/mutex.rs:22:9

Stack:

214/e/l.wbg.__wbg_new_693216e109162396@http://localhost:8000/script/stork.js:1:2409
@http://localhost:8000/script/stork.wasm:wasm-function[231]:0x3992d
@http://localhost:8000/script/stork.wasm:wasm-function[742]:0x46c03
@http://localhost:8000/script/stork.wasm:wasm-function[307]:0x3de0d
@http://localhost:8000/script/stork.wasm:wasm-function[389]:0x41600
@http://localhost:8000/script/stork.wasm:wasm-function[601]:0x460af
@http://localhost:8000/script/stork.wasm:wasm-function[510]:0x44a43
@http://localhost:8000/script/stork.wasm:wasm-function[579]:0x45c66
@http://localhost:8000/script/stork.wasm:wasm-function[142]:0x32e45
@http://localhost:8000/script/stork.wasm:wasm-function[466]:0x43a90
@http://localhost:8000/script/stork.wasm:wasm-function[441]:0x43012
@http://localhost:8000/script/stork.wasm:wasm-function[116]:0x302bd
@http://localhost:8000/script/stork.wasm:wasm-function[380]:0x4104e
@http://localhost:8000/script/stork.wasm:wasm-function[296]:0x3d4dd
y@http://localhost:8000/script/stork.js:1:1669
139/t.resolveSearch@http://localhost:8000/script/stork.js:1:19389
934/e.prototype.performSearch@http://localhost:8000/script/stork.js:1:8182
771/e.prototype.handleInputEvent@http://localhost:8000/script/stork.js:1:14609
inputInputEvent@http://localhost:8000/script/stork.js:1:9709

stork.js:1:2623
    __wbg_error_09919627ac0992f5 http://localhost:8000/script/stork.js:1
    <anonymous> http://localhost:8000/script/stork.wasm:235948
    <anonymous> http://localhost:8000/script/stork.wasm:289795
    <anonymous> http://localhost:8000/script/stork.wasm:253453
    <anonymous> http://localhost:8000/script/stork.wasm:267776
    <anonymous> http://localhost:8000/script/stork.wasm:286895
    <anonymous> http://localhost:8000/script/stork.wasm:281155
    <anonymous> http://localhost:8000/script/stork.wasm:285798
    <anonymous> http://localhost:8000/script/stork.wasm:208453
    <anonymous> http://localhost:8000/script/stork.wasm:277136
    <anonymous> http://localhost:8000/script/stork.wasm:274450
    <anonymous> http://localhost:8000/script/stork.wasm:197309
    <anonymous> http://localhost:8000/script/stork.wasm:266318
    <anonymous> http://localhost:8000/script/stork.wasm:251101
    y http://localhost:8000/script/stork.js:1
    resolveSearch http://localhost:8000/script/stork.js:1
    performSearch http://localhost:8000/script/stork.js:1
    handleInputEvent http://localhost:8000/script/stork.js:1
    inputInputEvent http://localhost:8000/script/stork.js:1
StorkError: Could not parse data from wasm_search. If you see this, please file a bug: https://jil.im/storkbug null
    t http://localhost:8000/script/stork.js:1
    resolveSearch http://localhost:8000/script/stork.js:1
    performSearch http://localhost:8000/script/stork.js:1
    handleInputEvent http://localhost:8000/script/stork.js:1
    inputInputEvent http://localhost:8000/script/stork.js:1
stork.js:1:8334

This happens with the stork 1.6.0 build for Ubuntu 20.04 downloaded from the website.