ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilya Kasnacheev <ilya.kasnach...@gmail.com>
Subject ConcurrentLinkedHashMap works incorrectly after clear()
Date Tue, 24 Jul 2018 13:03:22 GMT
Hello igniters!

So I was working on a fix for
https://issues.apache.org/jira/browse/IGNITE-9056
The reason for test flakiness turned out our ConcurrentLinkedHashMap (and
its tautological cousin GridBoundedConcurrentLinkedHashMap) is broken :(

When you do clear(). its size counter is not updated. So sizex() will
return the old size after clear, and if there's maxCnt set, after several
clear()s it will immediately evict entries after they are inserted,
maintaining map size at 0.

This is scary since indexing internals make intense use of
ConcurrentLinkedHashMaps.

My suggestion for this fix is to avoid ever calling clear(), making it
throw UnsupportedOperationException and recreating/replacing map instead of
clear()ing it. Unless somebody is going to stand up and fix
ConcurrentLinkedHashMap.clear() properly. Frankly speaking I'm afraid of
touching this code in any non-trivial way.

-- 
Ilya Kasnacheev

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message