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

athenad: fix thread safety issues in upload handing #34084

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Nov 22, 2024

This PR addresses thread safety issues by adding synchronization for shared variables, which previously led to race conditions and data inconsistencies. The updates enhance data integrity and system stability.

  1. Simplified Queue Management: Removed cancelled_uploads. Canceled items are now directly removed from upload_queue in the cancelUpload function, reducing complexity and ensuring consistent synchronization.
  2. Thread-Safe Access: Direct access to upload_queue.queue bypassed the Queue’s synchronization. This update ensures thread-safe access by using the mutex lock provided by the Queue, preventing race conditions.
  3. Mutex Protection for cur_upload_items: Ensured safe access with a mutex for cur_upload_items.

@deanlee deanlee force-pushed the athenad_fix_thread_safety_issue branch from f7caf35 to eb5cddb Compare November 22, 2024 09:50
@deanlee deanlee marked this pull request as ready for review November 22, 2024 10:02
@deanlee deanlee marked this pull request as draft November 22, 2024 10:10
@deanlee deanlee force-pushed the athenad_fix_thread_safety_issue branch from eb5cddb to e68e17f Compare November 24, 2024 07:44
@deanlee deanlee marked this pull request as ready for review November 24, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant