Skip to content

fix(storage): Fix rare edge case of transfer status update crash #3006

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

Merged
merged 8 commits into from
Mar 31, 2025

Conversation

tylerjroach
Copy link
Member

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:
#2663

Description of changes:
Attempt to fix: #2663 with minimal changes.

Concurrent Java collections aren't necessarily safe if wrapped in Kotlin mutable types (MutableList, MutableMap, MutableSet). Some of these helper operations contain multiple steps which could cause a loss of concurrency safety.

transferStatusListenerMap now contains items of ConcurrentHashMap instead of an ArrayList (The Key is important, the Boolean is just an unused placeholder. A Set would be more appropriate but attempting to keep concurrency here. ConcurrentHashMap.newKeySet() could have been used to make the implementation more Set like, but was concerned about the loss of putIfAbsent and would have had to run a multi step operation of contains + put.

The implementation of this class has multiple convoluted synchronization approaches and should still be tracked with an eventual full re-write to build in proper thread safety. However, this is an attempt to fix the ongoing edge-case crash in the meantime.

How did you test these changes?
(Please add a line here how the changes were tested)

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tylerjroach tylerjroach requested a review from a team as a code owner March 25, 2025 15:29
@tylerjroach
Copy link
Member Author

not currently working. still need to test.

@tylerjroach tylerjroach merged commit 9f7d6e7 into main Mar 31, 2025
3 checks passed
@tylerjroach tylerjroach deleted the tjroach/transfer-status-fix-attempt branch March 31, 2025 15:18
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.

ArrayIndexOutOfBoundsException caused by TransferStatusUpdater.unregisterListener$lambda$15
2 participants