Closed daninus14 closed 8 months ago
It looks like this is the culprit: GENERATE-RANDOM-ID
Update: I think this is a problem with the seed and the underlying library used for generating the random numbers.
To reproduce the problem:
(let ((ctx (isaac:init-self-seed :count 5 :is64 T)))
(dotimes (n 100) (isaac:rand-bits-64 ctx 160)))
So since lack.util is using isaac, it's causing a problem after a number of random numbers generated.
Doing this:
(let ((ctx (isaac:init-self-seed :count 5 :is64 T)))
(dotimes (n 100)
(format T "~A: ~A~%" n (isaac:rand-bits-64 ctx 160))))
I seem to consistently get an issue after 84 runs.
I will check the cl-isaac docs, however, this is an issue in ningle itself for relying on this library with an issue.
Can you please fix this?
By the way, is this thread safe? Since ningle is using threads, we should be concerned as well. I haven't tested for issues with thread safety, but another thing to think about.
What are your thoughts?
I've figured out that cl-isaac's context is not thread-safe. Thus generate-random-id should wrap the call to cl-isaac into the bt2:with-lock
.
@svetlyak40wt thanks for checking that!
Update: @svetlyak40wt also fixed the underlying bug in the cl-isaac library, however, it looks like the maintainer is not active in github so he hasn't accepted the pull-request. Because of that, unless one is using qlot and specifying the fork, or downloading to local-projects in quicklisp, this project (lack) is broken for depending on cl-isaac.
Summary of What Needs To Get Done:
(defun cl-isaac:rand64)
and (defun cl-isaac:rand32)
like the changes in the pull-request from @svetlyak40wt In the meantime I'll send an email to @thephoeron to see if he can accept the PR.
Closing this since PR #82 has been merged. Thanks
I am getting the following error:
The value -1 is not of type (UNSIGNED-BYTE 64)
Here's the stacktrace:
I wasn't getting the error before. Not sure if it's because of an update.
Any ideas on what I can do?