[elephant-devel] serializer not thread safe!
Alex Mizrahi
killerstorm at newmail.ru
Wed May 28 09:26:03 UTC 2008
obviously broken code:
(defun get-circularity-hash ()
"Get a clean hash for object serialization"
(declare (type fixnum *circularity-initial-hash-size*))
(if (= 0 (length *circularity-hash-queue*))
(make-hash-table :test 'eq :size *circularity-initial-hash-size*)
(ele-with-fast-lock (*serializer-fast-lock*)
(vector-pop *circularity-hash-queue*))))
concurrent call could happen between check and pop, thus invalidating the
check.
(defun get-cicularity-hash ()
(or
(ele-with-fast-lock (*serializer-fast-lock*)
(and (plusp (length *circularity-hash-queue*))
(vector-pop *circularity-hash-queue*)))
(make-hash-table :test 'eq :size *circularity-initial-hash-size*)))
More information about the elephant-devel
mailing list