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

Stop crashing when panic occurs in thread pool #4593

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

Kerollmops
Copy link
Member

@Kerollmops Kerollmops commented Apr 22, 2024

This PR fixes #4362 by introducing a new boolean to catch panics in the rayon thread pool. The boolean is read after performing the operations in rayon, and the indexation process is stopped. This first version doesn't expose the panic message but marks the task as failed.

The current implementation exposes a ThreadPoolNoAbort wrapper. The rayon::ThreadPool has been wrapped to check that nothing went wrong after running the ThreadPool::install function. An atomic boolean and some store/load logic make the system work efficiently.

Before, Meilisearch was completely crashing...

Capture d’écran 2024-04-22 à 15 49 02

Now, it handles the panics correctly and marks the task as failed.

Capture d’écran 2024-04-22 à 15 42 14

@curquiza
Copy link
Member

@Kerollmops if you want to make it available for v1.8, you should not merge into main

@Kerollmops Kerollmops changed the base branch from main to release-v1.8.0 April 22, 2024 14:02
@Kerollmops Kerollmops added this to the v1.8.0 milestone Apr 22, 2024
@Kerollmops Kerollmops marked this pull request as ready for review April 24, 2024 14:42
Copy link
Member

@ManyTheFish ManyTheFish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

Copy link
Contributor

meili-bors bot commented Apr 24, 2024

@Kerollmops Kerollmops merged commit 3e5cd02 into release-v1.8.0 Apr 24, 2024
10 checks passed
@Kerollmops Kerollmops deleted the rayon-catch-panics branch April 24, 2024 17:05
@meili-bot meili-bot added the v1.8.0 PRs/issues solved in v1.8.0 released on 2024-05-06 label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.8.0 PRs/issues solved in v1.8.0 released on 2024-05-06
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stops crashing the whole instance when a bug occurs in the indexing process
4 participants