Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer panics #2540

Open
Barre opened this issue Nov 7, 2024 · 1 comment
Open

Indexer panics #2540

Barre opened this issue Nov 7, 2024 · 1 comment
Labels

Comments

@Barre
Copy link
Contributor

Barre commented Nov 7, 2024

Describe the bug

  • Inserting u64 values into a date field makes index writer panic called Result::unwrap()on anErr value: ErrorInThread("An index writer was killed.. A worker thread encountered an error (io::Error most likely) or panicked.")
  • Indexer panicked
  • Indexing should not panic.

Which version of tantivy are you using?

0.22.0

To Reproduce

https://github.com/Barre/tantivy_indexing_panic_date_reproduction/blob/master/src/main.rs

@pinylin
Copy link

pinylin commented Feb 8, 2025

It seems like caused by index_documents (here), as the error TantivyError::SchemaError("Expected a Date for field wrong_date") is returned, which terminates the thrd-tantivy-index-xxx then triggers the Drop call for index_writer_bomb

impl<D: Document> Drop for IndexWriterBomb<D> {
    fn drop(&mut self) {
        if let Some(inner) = self.inner.take() {
            inner.kill();
        }
    }
}
impl<D: Document> Inner<D> {
    fn kill(&self) {
        self.is_alive.store(false, Ordering::Relaxed);

and removing the ? here does helpful resolve the bug, maybe further optimization is needed ?

let _ = index_documents(
	mem_budget,
	index.new_segment(),
	&mut document_iterator,
	&segment_updater,
	delete_cursor.clone(),
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants