enforce_once triggering more than expected
tsloughter opened this issue · 3 comments
In a 2 node cluster our logs are showing a period where the erleans enforce_once
callback is being triggered over and over for the same elements.
The Erleans code logs when it deactivates a grain after an enforce_once
triggers: https://github.com/SpaceTime-IoT/erleans/blob/master/src/erleans_pm.erl#L38-L60
I've now noticed that the problem may be unrelated to enforce_once
because I'm seeing that the size of the sets for the elements are at times as large as 24. Clearly an issue in erleans that it is letting 24 grains register with the same name when there are only 2 nodes, meaning even on the same node a grain id is able to be registered many times.
But I also noticed that for a grain that has a set size of 2 there being logs in the same second for deactivate_dups
called 3 times. So still seems excessive even if the more important problem is unrelated to enforce_once
.
I think what you really want here is instead of {cardinality, 2}
, you want {strict, {cardinality, 1}}
which will fire when it's not only 2, but when it's moving from 1 to 2.
Can you try that?
Yea, I can change it to use that.
Please reopen if you run into more issues with this.