You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sol Thiessen (Jira)" <ji...@apache.org> on 2026/07/09 09:40:00 UTC

[jira] [Created] (COLLECTIONS-894) TreeBag documentation should explicitly warn about infinite loop as a result of concurrent writes

Sol Thiessen created COLLECTIONS-894:
----------------------------------------

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


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)