Just curious, how did you immediately eliminate the possibility that the reducing function was mutating the list that is being reduced? No concurrency involved. In regular Java the 95% leading cause of CME is precisely that.
Anyway, this applies to immutable structures per se, whether combined with atoms, refs, or none. But a full wartime story must also cover how the solution avoids the pitfalls of retryable transactions. This is the real sore point in my experience, and the one which makes STM an all-or-nothing enterprise. On Tuesday, December 11, 2012 8:53:40 PM UTC+1, stuart....@gmail.com wrote: > > Hi Paul, > > Here is a real-world, production software example of the advantage of > values+refs over mutable objects and locks. A Datomic user reported the > following stack trace as a potential bug: > > 12:45:43.480 [qtp517338136-84] WARN c.v.a.s.p.e.UnknownExceptionHandler > - UnknownExceptionHandler: null > java.util.ConcurrentModificationException: null > at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819) > ~[na:1.7.0_07] > at java.util.ArrayList$Itr.next(ArrayList.java:791) ~[na:1.7.0_07] > at clojure.core.protocols$fn__5871.invoke(protocols.clj:76) > ~[clojure-1.4.0.jar:na] > at > clojure.core.protocols$fn__5828$G__5823__5841.invoke(protocols.clj:13) > ~[clojure-1.4.0.jar:na] > at clojure.core$reduce.invoke(core.clj:6030) > ~[clojure-1.4.0.jar:na] > > I immediately had 99% confidence that the bug was in user code, and even a > pretty good idea what went wrong. A call to "reduce" is a functional > transformation, and it expects to be passed values. The exception clearly > indicates a violation of that contract, and is caused by cross-thread > aliasing and mutation in the calling code. > > Regards, > Stu > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en