Skip to content

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