Fix fingerprint processor failures during concurrent bulk request - #23027
Conversation
Signed-off-by: tanyabti <tanyabti@amazon.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23027 +/- ##
============================================
+ Coverage 71.67% 71.76% +0.09%
- Complexity 77559 77640 +81
============================================
Files 6168 6168
Lines 360105 360105
Branches 52380 52380
============================================
+ Hits 258095 258421 +326
+ Misses 81495 81181 -314
+ Partials 20515 20503 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
The fingerprint ingest processor failed under concurrent bulk ingestion, throwing
ArrayIndexOutOfBoundsExceptionfrom the native crypto provider and, once triggered, breaking all fingerprint hashing on the affected node until it was replaced.Cause: The
HashMethodenum cached a singleMessageDigestinstance per algorithm and reused the same one for every request.MessageDigestis not thread-safe, so when multiple ingest threads used that shared instance at once, they corrupt its internal state.Fix: Store a supplier per algorithm and resolve a fresh per-call (ThreadLocal-backed) digest on each
execute(). Now each call gets its own fresh (thread-local)MessageDigest, so threads no longer share one. Added a test that runs the processor from many threads at once and checks the output stays correct with no errors.Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.