Unfortunately, no, but not from lack of trying.

The best lead I've got thus far is that there is a disj call that returns a 
defective set, which returns a positive value for count, but does not seem 
to contain any elements.

I've tried to capture the offending values, but I can't reproduce the bug 
with them. I can't arrange the elements of the set to be in the same order, 
and I can't get the same hash values for the maps (which contain js 
objects).

I suspect the issue may have something to do with hash collisions. The app 
state is being shuffled with some randomness, and the problem arises 
consistently after a minute or two of churn. If I add an extra "artificial" 
hash field to each element stored in the set, then the problem disappears 
(or perhaps it is postponed). I noticed that the defective sets always 
contain many elements with the same hash. (I know very little about how 
sets and hashing are implemented.)

I'll keep debugging.

- austin

On Tuesday, May 20, 2014 8:36:37 AM UTC-7, David Nolen wrote:
>
> Can you demonstrate a complete minimal example?
>
> Thanks,
> David
>
>
> On Tue, May 20, 2014 at 4:06 AM, Austin Haas 
> <aus...@pettomato.com<javascript:>
> > wrote:
>
>> I'm having trouble isolating a small test case. I call the following code 
>> in an update tick:
>>
>> (let [prev'  @prev
>>       state' @state]
>>   (let [rems (clojure.set/difference prev' state')
>>         adds (clojure.set/difference state' prev')]
>>     (reset! prev state')
>>     (assert (= (count rems) (count (set rems))))))
>>
>> (prev and state hold sets of maps.)
>>
>> After running for a few minutes, the assert will fail. The 'rems' and 
>> 'adds' will report that their count is > 1, but when I try to access the 
>> elements there are either none or only one.
>>
>> What would cause a set to return an incorrect value for count?
>>
>> FWIW, the elements of the sets are maps, and one of the fields holds a 
>> mutable javascript array. That was my first suspicion, but the array isn't 
>> mutated in my code, and I use a memoized function to generate it (to 
>> preserve identity).
>>
>> I'm using [org.clojure/clojurescript "0.0-2202"].
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to