Re: Strange problem (maybe: CLSQL thread safety)

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Sun, 5 Dec 2010 09:29:39 -0700
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
On Dec 2, 2010, at 8:25 AM, Nicolas Neuss wrote:
> [...]
> Here is a strange problem which might be due to some problems with
> thread-safety of the functions CLSQL-SYS::FIND-ALL and
> CLSQL-SYS::BUILD-OBJECTS in the file"sql/oodml.lisp".  Almost at the same
> time I obtained two similar emails indicating that somehow one of my server
> threads obtained a slot value which should belong to the other thread (and
> maybe also vice versa).  Did someone here encounter this problem too?  Or
> can someone spot where it might arise?

An interesting question. I inherited FIND-ALL and BUILD-OBJECTS a number
of years ago when someone worked to port the abandoned object-oriented
features of uncommonsql to CLSQL. Those are complex function that I
extended with additional functionality and also tried to simplify
through refactoring.

While I haven't looked at the code in years, I don't think there's any
obvious issue with threading (assuming in your application, each thread 
keeps its database object separate). But, I also think the functions
could use another refactoring to simplify and make their purpose
more transparent.

If you find some improvement or fix needed, I'd be glad to incorporate it.

Kevin