Fork me on GitHub
#cljs-dev
<
2016-05-27
>
thheller08:05:18

@rohit nice job tracking that down. weird how it would affect the hash of :version as that is clearly not nil, but I guess we should not question JS. 😉

rohit08:05:50

@thheller: as part of calculating the hash of a keyword, you need to calculate hash-string of its ns which in most cases is null. that was the root of the bug.

thheller08:05:10

ah! that makes sense

thheller08:05:05

nice catch, I was ready to blame imul again 😉

rohit08:05:32

so this is the sequence of things:

rohit08:05:37

1. When the system starts cache contains nil as ”null" and its value is 0 2. We compute hash of :version taking that 0 into account. 3. Loads of operations such that the cache is reset. 4. We calculate the hash of ”null” as it is in a set. Now the value in the cache of ”null" is something other than 0 5. We create a new :version taking the new value of ”null" cache entry and try to compare its hash to earlier one and they do not match. 6. The whole system is now unstable.

thheller08:05:25

seems obvious if you go through the steps 🙂

thheller08:05:52

but not at all obvious at first

rohit08:05:45

my colleague @skapoor pointed out the length of maps and imports affected point 3. hence the issue was only showing up under some very specific conditions.

rohit08:05:20

luckily/unluckily we were hitting that magic number of cache entries

thheller08:05:49

yeah it was extremely confusing that removing the def COLOURS in your example "fixed" the problem

thheller08:05:24

but it created more hash keys so pretty obvious in hindsight

thheller08:05:44

still, nice job.

rohit08:05:40

cheers. and thanks for pointing to where to look. 🙏