[ORC] Crash when GC attempts to collect element
shayanhabibi opened this issue · comments
Orc crashes when a Continuation (or any ref object) passed through the queue reaches the end of its life span and the final =destroy
is run.
This is evident by incrementing the ref count of an object by 1 before the end of its lifespan and comparing the behaviour before and after.
ARC does not share this issue; the final =destroy
can be called without issue and the memory is collected appropriately.
AFAIK this is a ORC bug
What would need to be done to make a ref reach the end of its lifetime? Like what would a small example look like?
block:
var x = new (ref int)
x[] = 3
# x reached the end of its lifetime
To restate the problem, the issue is that Nim's ORC tracking of each memory graph is thread-local, so moves across threads leave such references in a bogus state should they be collected in a "foreign" thread...