bigreybear opened a new pull request, #11770:
URL: https://github.com/apache/iotdb/pull/11770

   ## Description
   Previously, a NPE could occur due to eviction checks and executions being 
performed on different objects. 
   
   If two threads, T1 and T2, concurrently decrement the reference count of the 
same page, one would be blocked by an exclusive lock before entering eviction 
process. Suppose T1 acquires the lock and completes the eviction. Before T2 can 
obtain the lock, another thread T3 might acquire it and attempt to read the 
evicted page. This action triggers a disk read and creates a new page object, 
even while T2 still holds a page object with the same ID. Eventually, when T2 
proceeds with eviction, it finds the reference count of its page to be zero and 
evicts the page with same ID which is actually held by T3. This erroneous 
eviction could subsequently lead to an NPE when T3 finishes all taks and 
attempts to evict the same page from the cache.
    
   This PR has:
   - [ ] been self-reviewed.
       - [ ] concurrent read
       - [ ] concurrent write
       - [ ] concurrent read and write 
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods. 
   - [ ] added or updated version, __license__, or notice information
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious 
     for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold 
     for code coverage.
   - [ ] added integration tests.
   - [ ] been tested in a test IoTDB cluster.
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not 
all of these items 
   apply to every PR. Remove the items which are not done or not relevant to 
the PR. None of the items 
   from the checklist above are strictly necessary, but it would be very 
helpful if you at least 
   self-review the PR. -->
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) 
in this PR
   


-- 
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