Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(server): resolve deadlock during concurrent segment reads #1539

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

hubcio
Copy link
Contributor

@hubcio hubcio commented Feb 15, 2025

This commit addresses a deadlock issue in file reading operations by
refactoring the code to use Arc<File> instead of RwLock<Option<File>>.
The changes ensure that file operations are performed in a non-blocking
manner using spawn_blocking and read_exact_at. This improves the
concurrency and efficiency of file access, particularly in scenarios
where multiple tasks are reading from the same file concurrently. The
commit also includes error handling improvements for better diagnostics
and robustness.

Besides that, posix_fadvise(sequential) is added for segment files
to improve page cache utilization.

spetz
spetz previously approved these changes Feb 15, 2025
@hubcio hubcio force-pushed the fix-deadlock-on-reading branch 7 times, most recently from 1d837b7 to 87b2d72 Compare February 16, 2025 16:03
spetz
spetz previously approved these changes Feb 16, 2025
This commit addresses a deadlock issue in file reading operations by
refactoring the code to use `Arc<File>` instead of `RwLock<Option<File>>`.
The changes ensure that file operations are performed in a non-blocking
manner using `spawn_blocking` and `read_exact_at`. This improves the
concurrency and efficiency of file access, particularly in scenarios
where multiple tasks are reading from the same file concurrently. The
commit also includes error handling improvements for better diagnostics
and robustness.

Besides that, posix_fadvise(sequential) is added for segment files
to improve page cache utilization.
@hubcio hubcio force-pushed the fix-deadlock-on-reading branch from f64629a to eb9972f Compare February 16, 2025 20:24
@spetz spetz merged commit 48ba0ce into master Feb 16, 2025
14 checks passed
@spetz spetz deleted the fix-deadlock-on-reading branch February 16, 2025 20:39
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants