I'm out of my league on this, but I minimized it further.
Something pretty low-level is going wrong.
If the MOCK-REHASH function below is changed not to read the INFO-ENV-COUNT slot, then no crash. Otherwise crash.

* (in-package sb-c)
#<PACKAGE "SB-C">

* (defun mock-rehash (env)
    (let ((old-count (info-env-count env)))
      (print (setf (info-env-storage env) (make-info-storage (ceiling old-count .5))))))

* (defun foo2 (&aux (table (sb-c::make-info-hashtable)))
  (let ((thread
         (sb-thread:make-thread (lambda () (mock-rehash table)))))
    (sb-thread:join-thread thread)
    (print 'back-here) (force-output)
    (print (info-env-storage table)) ; does not gets printed
    (force-output)))

* (foo2)
#(3 2 #() 0 0 0 NIL NIL NIL)
BACK-HERE
Segmentation fault




On Thu, Mar 27, 2014 at 5:04 AM, Stas Boukarev <stassats@gmail.com> wrote:
:lockfree-hash-concurrent-twiddling and
:lockfree-hash-concurrent-consing crash hard.

A reduced test case:

(defun test (&key (table (sb-c::make-info-hashtable))
                  (threads 2) (iterations 1000))
  (mapc #'sb-thread:join-thread
        (loop repeat threads
              collect
              (sb-thread:make-thread
               (lambda ()
                 (loop for i from 1 to iterations
                       do
                       (sb-c::info-puthash
                        table i
                        (constantly nil))))))))

(test)

=>
Segmentation fault.
--
With best regards, Stas.