[Openmcl-devel] Intermittent FFI problem

Ron Garret ron at flownet.com
Thu Apr 7 01:56:09 UTC 2016


I have made some progress on debugging this.  It is definitely a CCL bug, and very strange one.  Here’s how to reliably reproduce it:

1.  Start the IDE and run the following code.  Important: do not click on any menus other than the LISP menu (to select “evaluate all” if you wish)

(open-shared-library "libssl.dylib")
(foreign-symbol-address "SSL_get_version")
(close-shared-library (car ccl::*shared-libraries*))
(foreign-symbol-address "SSL_get_version”)

2.  Note that the last value returned is NIL.  Note also that this behavior is consistent no matter how many times you run the code.

3.  Click on the “Windows” menu.  Don’t actually select a window, just activate the menu and de-activate it again.  (The FILE and EDIT menus work to produce the bug as well, but not LISP or TOOLS.)

4.  Run the above code again.  Note that the last value returned is no longer NIL.

This is reliably reproducible in 1.10-r16479M and 1.11-dev-r16485M-trunk.  I have not tried any other versions.

rg

On Mar 31, 2016, at 2:48 PM, Ron Garret <ron at flownet.com> wrote:

> I’m facing a very complicated and annoying problem.
> 
> I’m trying to use Drakma to connect to an HTTPS server.  The problem is that Drakma uses CL+SSL, which uses libssl, which is out of date on OS 10.9.5. (It’s version 0.9.8) and it won’t let me connect to one particular server (api.name.com in case you want to try to reproduce this problem).
> 
> Normally the solution would be to simply update libssl, but unfortunately that doesn’t work.  When I tried it, it made MacOS very (very!) unhappy and actually rendered my Mac unbootable.  (So don’t try it!)
> 
> So I have to install the updated libssl somewhere else, like /usr/local/lib.
> 
> Unfortunately, CL+SSL hard-codes the path to libssl as follows:
> 
> (cffi:define-foreign-library libssl
> ...
>  (:darwin (:or "libssl.dylib" "/usr/lib/libssl.dylib”))
>> 
> and it does not seem to respect cffi:*foreign-library-directories*.  No matter when I set that to, it picks up the outdated libssl in /usr/lib.
> 
> So I tried the following:
> 
> 1.  Load CL+SSL
> 2.  (cffi:close-foreign-library (gethash 'cl+ssl::libssl cffi::*foreign-libraries*))
> 3.  (cffi:load-foreign-library "libssl" :search-path "/usr/local/ssl/lib/libssl.dylib”)
> 
> That works 99% of the time.  But every now and then it fails.  I can’t reliably reproduce it, but my startup sequence is always exactly the same each time.  The only pattern seems to be that it’s more likely to fail after CCL has not been running for a while, so it might be a cache issue, but the failures are infrequent enough that I don’t really have enough data to tell.  All I know is that I’ve never had two failures in a row.  Quitting and restarting after a failure has always worked.
> 
> Any ideas on what might be causing this?
> 
> rg
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list