[cffi-devel] CCL on Windows errors

Anton Vodonosov avodonosov at yandex.ru
Sun Apr 10 07:56:30 UTC 2011


One more question about my crash.

I have impression, that the callback is called from a non-Lisp thread, i.e. 
a thread that was not started by list, but was started by foreign code.

Is it known/supposed to work/fail? In CCL (and in general).

Best regards,
- Anton

09.04.2011, 19:44, "Anton Vodonosov" <avodonosov at yandex.ru>:
> Hello.
>
> I have a crash when use CFFI + CCL + callbacks on Windows.
>
> I am not sure the crash is caused by CFFI, there is another suspect. But the CFFI tests on Windows have errors.
> Could you take a look to the test results (attached)? This is CFFI 0.10.6
>
> About the crash. It happens with CL+SSL.
>
> OpenSSL requires multi-threaded applications to provide a callback, which implements locking,
> as described here: http://www.openssl.org/docs/crypto/threads.html.
>
> The callback function prototype is
>
>    void locking_function(int mode, int n, const char *file, int line)
>
> The callback is installed using
>
>   void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
>                                               const char *file,int line))
>
> CL+SSL has the following definitions:
>
> (cffi:defcallback locking-callback :void
>     ((mode :int)
>      (n :int)
>      (file :string)
>      (line :int))
>   ;(declare (ignore file line))
>
> ;; the callback body here
>
> )
>
> (cffi:defcfun ("CRYPTO_set_locking_callback" crypto-set-locking-callback)
>     :void
>   (fun :pointer))
>
> If during initialization of CL+SSL we do
>
>   (crypto-set-locking-callback (cffi:callback locking-callback))
>
> then we have a crash at the first SSL connection to hunchentoot. The crash is 100% reproducible.
>
> It doesn't matter what we have in the callback body, it may be even empty. The symptoms are
> always the same.
>
> If we comment out the line
>
> ;;  (crypto-set-locking-callback (cffi:callback locking-callback))
>
> then the crash doesn't happen.
>
> As I said, I am not sure CFFI is the cause of the crash. I tried to print the values
> passed to the callback, they are not corrupted, valid numbers and strings.
> Also, the callback is called thousands of times before the crash happen.
>
> But on the other hand, if we don't set the callback, the crash doesn't happen;
> and setting even empty callback guarantees the crash...
>
> Anyway, If you provide any patches to CFFI, at least to fix the tests, I can
> run the tests on Windows.
>
> Best regards,
> - Anton
>
> _______________________________________________
> cffi-devel mailing list
> cffi-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel




More information about the cffi-devel mailing list