[Openmcl-devel] Need advice to debug segfault when runningconcurrent selects in clsql/postgresql
Paul Meurer
paul.meurer at uni.no
Thu Oct 31 02:13:32 PDT 2013
Am 31.10.2013 um 10:05 schrieb gainsttime at yandex.ua:
> 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?
Yes. CFFI is in this case nothing more than a wrapper around the CCL FFI functions. I removed the CFFI dependency to make the code independent from 3rd party code.
- Paul
--
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20131031/faf95868/attachment.htm>
More information about the Openmcl-devel
mailing list