[cffi-devel] Array call crashes SBCL on one computer

Liam M. Healy lnp at healy.washington.dc.us
Sun Mar 19 17:53:19 UTC 2006


I have two computers, both Linux/x386.
 - The desktop is Debian unstable, Darcs pull 2006-03-07 23:11, SBCL 0.9.8.42
 - The laptop is Ubuntu 05.10, Darcs pull 2006-03-17 23:59, SBCL 0.9.9
On both I have GSL (libgsl0) installed, which includes two libraries
/usr/lib/libgslcblas.so.0
/usr/lib/libgsl.so.0
which I have made links to the corresponding .so names.

On each I do:
(require :asdf)
(require :cffi)
(in-package :cffi)
(cffi:load-foreign-library "/usr/lib/libgslcblas.so") 
(cffi:load-foreign-library "/usr/lib/libgsl.so") 

(with-foreign-objects ((retn :double))
  (foreign-funcall "gsl_sf_bessel_Jn_array"
		   :int 0
		   :int 2
		   :double 0.25d0
		   :pointer retn
		   :int)
  (mem-aref retn :double 0))

On the desktop, everything works normally and I get
0.9844359292958527d0

On the laptop, I get an SBCL crash with the following message:

  Argh! corrupted error depth, halting
  fatal error encountered in SBCL pid 29184(tid 3085391552):
  %PRIMITIVE HALT called; the party is over.

  The system is too badly corrupted or confused to continue at the Lisp
  level. If the system had been compiled with the SB-LDB feature, we'd drop
  into the LDB low-level debugger now. But there's no LDB in this build, so
  we can't really do anything but just exit, sorry.

Some other results on the laptop:
- All functions I've tried that return a pointer to an array of doubles
have this problem.
- Sometimes the problem behavior varies.  For example, If the third
argument is 0.5d0, SBCL simply locks up instead of crashing.
Sometimes I get an infinite output of error messages that repeat the
line "mprotect: Cannot allocate memory" over and over.

Any debugging advice?
Thanks.

Liam



More information about the cffi-devel mailing list