lweitzendorf opened a new pull request, #3205:
URL: https://github.com/apache/jackrabbit-oak/pull/3205

   https://issues.apache.org/jira/browse/OAK-12450
   
   ## Summary
   Fixes three issues in `ThreadSpecificSegmentBufferWriterPool`:
   - **Read lock leak:** `execute()` obtained the per-thread writer before 
entering `try/finally`. If creating the writer threw, the read lock was never 
released and a later `flush()` blocked forever. The writer is now obtained 
inside `try/finally`.
   - **Data race on `writerId`:** `writerId` was a plain `short` incremented 
inside `computeIfAbsent`'s mapping function, which can run concurrently for 
different keys. It is now an `AtomicInteger` updated with a bounded 
`getAndUpdate`.
   - **Dead threads kept alive:** the pool was keyed by `Thread`, retaining 
terminated threads and their `ThreadLocal`s until the next `flush()`. It is now 
keyed by thread ID. IDs are unique among live threads, so concurrent 
`execute()` calls never share a writer; a recycled ID simply reuses a dead 
thread's writer.
   
   ## Tests
   New cases in `SegmentBufferWriterPoolTest`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to