uschindler commented on PR #16931:
URL: https://github.com/apache/lucene/pull/16931#issuecomment-6473149277

   Hi,
   
   when discussing with Gianluca Graziadei on Community over Code he mentioned 
obviously the same thing:
   
   > I’ve tried to put into words the intuition I began discussing with you on 
wednesday morning about Arenas.
   > 
   > A counted shared arena is created with onClose = () -> arenas.remove(key), 
which removes by key:
   > - 
https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java#L412
   > - 
https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java#L422
   > 
   > When arena A runs out of permits, there is a method that replaces it in 
the map with a new arena B while A is still held by its inputs. 
   > When A's last holder closes, A's onClose removes the key, which now points 
to B. B is alive and in use but no longer in the map, so the next file of the 
same segment creates a third arena C instead of joining B. The same happens on 
every onClose retry after an IllegalStateException. 
   > 
   > Try with this serialization: 
   > open f1..f64   -> arenas: _1 -> A      (A exhausted)
   > open f65       -> arenas: _1 -> B      (A still held by 64 inputs)
   > close f1..f64  -> A.onClose runs arenas.remove("_1")  -> removes B
   > open f66       -> arenas: _1 -> C      (should have joined B)
   > 
   > A possible fix could be onClose = theArena -> arenas.remove("_1", theArena)
   
   to me this is the same issue, and fix looks identical!
   
   I will review soon and try to understand it. Can we get a (maybe AI 
generated) explanation why and how this fixes the code. Sorry for this, my 
brain is a bit overloaded with concurrent arenas.
   
   Uwe


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to