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

Meilisearch panic at search time #3785

Closed
irevoire opened this issue May 28, 2023 · 1 comment
Closed

Meilisearch panic at search time #3785

irevoire opened this issue May 28, 2023 · 1 comment
Labels
bug Something isn't working as expected v1.2.0 PRs/issues solved in v1.2.0 released on 2023-06-05
Milestone

Comments

@irevoire
Copy link
Member

Describe the bug
When I send the following totally legit request to meilisearch:

{
  "q":"\u001b[1m"
}

It returns:

{
  "message": "task 1983 panicked",
  "code": "internal",
  "type": "internal",
  "link": "https://docs.meilisearch.com/errors#internal"
}

Here is what I get in the logs:

thread 'tokio-runtime-worker' panicked at 'attempt to add with overflow', milli/src/search/new/query_term/parse_query.rs:82:25
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/std/src/panicking.rs:578:5
   1: core::panicking::panic_fmt
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/core/src/panicking.rs:117:5
   3: milli::search::new::query_term::parse_query::located_query_terms_from_tokens
             at ./milli/src/search/new/query_term/parse_query.rs:82:25
   4: milli::search::new::execute_search
             at ./milli/src/search/new/mod.rs:390:27
   5: milli::search::Search::execute
             at ./milli/src/search/mod.rs:106:13
   6: meilisearch::search::perform_search
             at ./meilisearch/src/search.rs:323:81
   7: meilisearch::routes::indexes::search::search_with_post::{{closure}}::{{closure}}
             at ./meilisearch/src/routes/indexes/search.rs:180:61
   8: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/blocking/task.rs:42:21
   9: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/core.rs:223:17
  10: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/loom/std/unsafe_cell.rs:14:9
  11: tokio::runtime::task::core::Core<T,S>::poll
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/core.rs:212:13
  12: tokio::runtime::task::harness::poll_future::{{closure}}
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/harness.rs:476:19
  13: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/core/src/panic/unwind_safe.rs:271:9
  14: std::panicking::try::do_call
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/std/src/panicking.rs:485:40
  15: __rust_try
  16: std::panicking::try
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/std/src/panicking.rs:449:19
  17: std::panic::catch_unwind
             at /rustc/9ecda8de85ce893cc3fc748ab06be0b8250147a7/library/std/src/panic.rs:140:14
  18: tokio::runtime::task::harness::poll_future
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/harness.rs:464:18
  19: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/harness.rs:198:27
  20: tokio::runtime::task::harness::Harness<T,S>::poll
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/harness.rs:152:15
  21: tokio::runtime::task::raw::poll
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/raw.rs:255:5
  22: tokio::runtime::task::raw::RawTask::poll
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/raw.rs:200:18
  23: tokio::runtime::task::UnownedTask<S>::run
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/task/mod.rs:431:9
  24: tokio::runtime::blocking::pool::Task::run
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/blocking/pool.rs:159:9
  25: tokio::runtime::blocking::pool::Inner::run
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/blocking/pool.rs:513:17
  26: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
             at /home/irevoire/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.27.0/src/runtime/blocking/pool.rs:471:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Expected behavior
It doesn't panic

Meilisearch version:
Latest rc

Additional context
It was working on the previous versions of meilisearch

@irevoire irevoire added the bug Something isn't working as expected label May 28, 2023
@irevoire irevoire added this to the v1.2.0 milestone May 28, 2023
meili-bors bot added a commit that referenced this issue May 29, 2023
3786: Consistently use wrapping add to avoid overflow in debug when query s… r=dureuill a=dureuill

# Pull Request

## Related issue
Fixes #3785

## What does this PR do?
- Some of the code paths would erroneously use the default addition operator that has the semantics that "overflow is an error, checked at runtime in debug" instead of the intended "overflow is expected" semantics that this code use (this code is using `u16::MAX` as a sentinel). This PR makes it so the wrapping add operator is used everywhere.

Co-authored-by: Louis Dureuil <louis@meilisearch.com>
@gillian-meilisearch
Copy link
Contributor

Closing this issue as it is resolved by #3786 and will be part of v1.2.0-rc.3

@meili-bot meili-bot added the v1.2.0 PRs/issues solved in v1.2.0 released on 2023-06-05 label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected v1.2.0 PRs/issues solved in v1.2.0 released on 2023-06-05
Projects
None yet
Development

No branches or pull requests

3 participants