Skip to content

Stop crashing when panic occurs in thread pool - #4593

Merged
Kerollmops merged 4 commits into
release-v1.8.0from
rayon-catch-panics
Apr 24, 2024
Merged

Stop crashing when panic occurs in thread pool#4593
Kerollmops merged 4 commits into
release-v1.8.0from
rayon-catch-panics

Conversation

@Kerollmops

@Kerollmops Kerollmops commented Apr 22, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
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 requested a review from ManyTheFish April 24, 2024 14:42
@Kerollmops
Kerollmops marked this pull request as ready for review April 24, 2024 14:42

@ManyTheFish ManyTheFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

bors merge

@meili-bors

meili-bors Bot commented Apr 24, 2024

Copy link
Copy Markdown
Contributor

@Kerollmops
Kerollmops merged commit 3e5cd02 into release-v1.8.0 Apr 24, 2024
@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