You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ralf Hauser (Jira)" <ji...@apache.org> on 2026/07/09 16:40:00 UTC
[jira] [Commented] (COLLECTIONS-894) TreeBag documentation should explicitly warn about infinite loop as a result of concurrent writes
[ https://issues.apache.org/jira/browse/COLLECTIONS-894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095045#comment-18095045 ]
Ralf Hauser commented on COLLECTIONS-894:
-----------------------------------------
and you if you get into a cycle, easily e.g. 12 cores become 100% cpu used... => top says 1200%
> TreeBag documentation should explicitly warn about infinite loop as a result of concurrent writes
> -------------------------------------------------------------------------------------------------
>
> Key: COLLECTIONS-894
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-894
> Project: Commons Collections
> Issue Type: Improvement
> Components: Bag
> Reporter: Sol Thiessen
> Priority: Major
> Labels: doc
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Due to the underlying TreeMap implementation, concurrent writes to TreeBag can result in a malformed tree structure with a cycle. This can cause threads to spin infinitely while putting or getting an entry from a TreeBag. While it is possible to discover that the TreeBag implementation is not thread safe by researching the TreeMap implementation, we would still like to request that the TreeBag documentation say so explicitly.
> For more info regarding the potential for cycle creation, this blog post was helpful: https://ivoanjo.me/blog/2018/07/21/writing-to-a-java-treemap-concurrently-can-lead-to-an-infinite-loop-during-reads/
--
This message was sent by Atlassian Jira
(v8.20.10#820010)