this pr solves #8. As discussed in issue, I have replaced erlang:system_info(logical_processors) with erlang:system_info(schedulers) and clear locks when tid change. To avoid races it is not enough to just wait for state->cache_lock but also threads waiting for rlock on cache_lock needs to check that locks were not cleared during their waiting hence checking lock->tid.
For testing nif changes I have returned to using erlang:system_info(logical_processors), added checks for return value from encoding()/decoding() and run unit tests with +S32:32 (my cpu has 8 logic cores).
Same tests fails on master with {error, tid_not_found}.
I have opened pr to solve eventual reservations about the code but I will yet conduct more tests.
Hi,
this pr solves #8. As discussed in issue, I have replaced
erlang:system_info(logical_processors)
witherlang:system_info(schedulers)
and clear locks whentid
change. To avoid races it is not enough to just wait forstate->cache_lock
but also threads waiting for rlock oncache_lock
needs to check that locks were not cleared during their waiting hence checkinglock->tid
.For testing nif changes I have returned to using
erlang:system_info(logical_processors)
, added checks for return value fromencoding()
/decoding()
and run unit tests with+S32:32
(my cpu has 8 logic cores). Same tests fails on master with{error, tid_not_found}
.I have opened pr to solve eventual reservations about the code but I will yet conduct more tests.