[Openmcl-devel] Need advice to debug segfault when runningconcurrent selects in clsql/postgresql

gainsttime at yandex.ua gainsttime at yandex.ua
Thu Oct 31 02:05:14 PDT 2013


On Wed, 30 Oct 2013, Paul Meurer wrote:

>   I did do several other tests:
> 
>   The code runs without problems both in ACL 9.0-smp, and in SBCL (both 64 bit Linux, 16 cores).
> 
>   Then I tried to build a minimal example that doesn't use any extra libraries, just plain CCL and a
>   very basic C lib, and I think I somehow succeeded.
> 
>   Here is the C library:
> 
>   ---
>   // threadtest.c
>   // Compilation:
>   // gcc -Bsymbolic -shared threadtest.c -fPIC -L/usr/local/lib -o threadtest.so;
>   #include <stdio.h>
> 
>   char *getstring() { return "asdfasdfasdfasdfasdfasdfasdfasdf" ; }
>   ---
> 
>   and here the Lisp code.
> 
>   ---
>   (open-shared-library "threadtest.so")
> 
>   (defun getstring () (%get-cstring (external-call "getstring" :address)))
> 
>   (dotimes (i 16)
>   (process-run-function
>    (format nil "getstring~a" i)
>    (lambda (i)
>      (let ((list ())
>     (size 0))
>        (dotimes (i 100000)
>   #-consing
>   (incf size (length (getstring)))
>   #+consing
>   (push (getstring) list))))
>    i))
>   ---
> 
>   Again, the equivalent code (using cffi) runs fine in Allegro, and crashes in CCL. It crashes
>   immediately with the consing variant, and only on the second or third run with the non- (or
>   less)-consing variant. The crashes are of the same type as with the Postgres lib.
> 
>   You might object that my simple-minded library is not threaded. If this is a valid objection, I
>   will try to write a threaded lib with a dedicated thread/connection for each lisp process. (I still
>   have to learn how this is done.) Yet I am wondering why I don't see similar behavior in ACL and
>   SBCL.
> 
>   - Paul

Does CFFI variant crash in CCL?


More information about the Openmcl-devel mailing list