Re: clsql:connect causes with-timeout to fail in sbcl

Brett van de Sande <[email protected]>
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
Here is what is happening:

It ends up that libmysql installs its own signal handler for SIGALRM,
overriding the sbcl signal handler, and doesn't reinstall the sbcl signal
handler when it is done.  This is a bug in the libmysql library, and not
the fault of clsql, as such.

There are three possible fixes:

1.  Modify libmysql so that it saves and reinstalls any
SIGALRM handlers during any calls to libmysql.  Something like:

  #include <signal.h>
  struct sigaction  old_action;
  sigaction (SIGALRM, NULL, &old_action);

  /* ... run mysql stuff */

  sigaction (SIGALRM, &old_action, NULL);

However, libmysql is pretty complicated and a patched libmysql
is a maintenance problem.

2.  In lisp, modify clsql so that it saves and reinstalls any
SIGALRM handlers during any libmysql calls.  However, in sbcl, it appears that
there is no existing mechanism to do this in the lisp code.

3.  Abandon clsql.  In my application, I am just doing some simple SQL 
queries, nothing fancy.  Stelian Ionescu <[email protected]> pointed
me to some code that implements some of the mysql socket API in lisp.

Thus, I went with number 3.  You can see the result at
http://github.com/bvds/andes/blob/master/Base/mysql-connect.cl

Brett
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.