Welcome! Please see the About page for a little more info on how this works.

0 votes
in Transducers by

The partition-by and partition-all transducers use state stored in an ArrayList. This state should be protected (for example, by volatile) to ensure visibility if used in a transducing process that moves computations across threads.

4 Answers

0 votes
by

Comment made by: leonoel

Discussion here : https://groups.google.com/forum/m/#!topic/clojure/VQj0E9TJWYY

0 votes
by

Comment made by: leonoel

Note that following this logic, transients are as much broken, as they make use of plain arrays.
This paragraph https://clojure.org/reference/transients#_concurrent_use makes me believe this very problem has already been tackled before. Is the discussion available somewhere ?
In my opinion, documentation should be more precise about what is meant by thread isolation, and explain why it is OK to use unsynchronized mutable objects when they're owned by something that enforces sequential processing (agents, go blocks, channels, single-threading, etc).

0 votes
by

Comment made by: alexmiller

Transients originally enforced thread isolation by recording and validating the originating thread. This was weakened to allow for transients passed around go blocks in Clojure 1.7 and has been through some rounds of fixes (like CLJ-1580). If there is an issue with them now, please file a separate ticket.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2146 (reported by alexmiller)
...