Sporadic "library routine called out of sequence" from Tcl interface?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Sporadic "library routine called out of sequence" from Tcl interface?

Charles Hines

Howdy all.

I've recently convinced someone here who was in need of a database for his in
house Tcl/Tk application (under Solaris 8) to try SQLite (which I have been
meaning to try myself for some personal projects that have yet to be started).
I helped facilitate this by putting together a "batteries included" tclkit for
him (built by me, tcl v8.4.9 + tk and a bunch of precompiled stuff pulled from
the latest ActiveTcl distro to save some time) that contained the SQLite Tcl
interface (v3.2.1 and today v3.2.2, also built by me).

Things seemed to be going rather well at first, but now quite frequently his
app is getting the "library routine called out of sequence" error (at
seemingly random times and places), and I have to say that I'm a little
perplexed.

He's not doing anything multithreaded, and the tclkit was not built w/ thread
support (I did compile the sqlite lib w/ thread support however).  He's only
using relatively simple inserts and selects.  He does have some 'after'
commands (both idle and timed) that are firing off calls to the SQLite layer,
however, and the db file (~50MB of data) is on an NFS mounted directory (I've
verifyied through standalone test cases that fcntl file locking "works" across
this interface) being used by multiple people (although I'm pretty sure we've
made the problem occur when others aren't accessing the db file, since there
are not many people using the program and its use is infrequent anyways so the
chances of collisions are pretty small).

I've tried using the various PRAGMAs to help debug it (side note: the vdbe
ones don't seem to be working for me, even though I compiled with the
--enable-debug flag) as well as putting in an sqlite3 trace command that dumps
the strings being sent so I can watch how things are progressing, and nothing
odd seems to be happening that is shown at that level.

So...given this tiny bit of info, does anyone here have any thoughts on what
might be happening, or hints on how to debug it further?  I'm considering
going in through dbx and investigating at that level, but thought that it
might be simpler to ask here first, where people who are more intimite with
the inner workings of SQLite might have some ideas to help me along faster.

Bear in mind that I'm not an expert on Tcl or SQLite, but I am a programmer
that is normally rather adept at problem solving so I'll likely get to the
heart of it eventually, but probably not before this guy throws in the towel
and switches to PostgreSQL at the rate I'm going. :(

Thanks,
Chuck

--
Charles K. Hines                                   <[hidden email]>

     "When things don't sound evil enough on their own I like to toss in
      a BU-WHA-HA-HA-HA".                       - Catbert (from Dilbert)

Reply | Threaded
Open this post in threaded view
|

Re: Sporadic "library routine called out of sequence" from Tcl interface?

Dennis Cote
Charles Hines wrote:

>I've tried using the various PRAGMAs to help debug it (side note: the vdbe
>ones don't seem to be working for me, even though I compiled with the
>--enable-debug flag) as well as putting in an sqlite3 trace command that dumps
>the strings being sent so I can watch how things are progressing, and nothing
>odd seems to be happening that is shown at that level.
>
>
>  
>
I ran into the same problem with the VDBE tracing. The configure script
doesn't define the correct compiler flags to generate the VDBE trace.
The fix is detailed in this message:

  http://www.mail-archive.com/sqlite-users@.../msg05936.html

HTH
Dennis Cote
Reply | Threaded
Open this post in threaded view
|

Re: Sporadic "library routine called out of sequence" from Tcl interface?

D. Richard Hipp
In reply to this post by Charles Hines
On Wed, 2005-06-22 at 16:37 -0400, Charles Hines wrote:
> Things seemed to be going rather well at first, but now quite frequently his
> app is getting the "library routine called out of sequence" error (at
> seemingly random times and places), and I have to say that I'm a little
> perplexed.
>

I'm perplexed too.  It isn't too hard to get an
SQLITE_MISUSE from the C interface (just call any
of the API routines with a bogus sqlite3* handle,
for example) but I thought the TCL interface
completely insulated you from all of that.

I've been looking through the code and trying
things and I cannot reproduce the problem.  Please
let me know if you get any more clues...
--
D. Richard Hipp <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: Sporadic "library routine called out of sequence"from Tcl interface?

Charles Hines
>>>>> "DRH" == D Richard Hipp <[hidden email]> writes:

DRH> On Wed, 2005-06-22 at 16:37 -0400, Charles Hines wrote:
>> Things seemed to be going rather well at first, but now quite frequently his
>> app is getting the "library routine called out of sequence" error (at
>> seemingly random times and places), and I have to say that I'm a little
>> perplexed.
>>

DRH> I'm perplexed too.  It isn't too hard to get an
DRH> SQLITE_MISUSE from the C interface (just call any
DRH> of the API routines with a bogus sqlite3* handle,
DRH> for example) but I thought the TCL interface
DRH> completely insulated you from all of that.

I had a feeling that should be the case...

DRH> I've been looking through the code and trying
DRH> things and I cannot reproduce the problem.  Please
DRH> let me know if you get any more clues...

I will.

Thanks,
Chuck

--
Charles K. Hines                                   <[hidden email]>

     "When things don't sound evil enough on their own I like to toss in
      a BU-WHA-HA-HA-HA".                       - Catbert (from Dilbert)

Reply | Threaded
Open this post in threaded view
|

Re: Sporadic "library routine called out of sequence" fromTcl interface?

Charles Hines
In reply to this post by Dennis Cote
>>>>> "Dennis" == Dennis Cote <[hidden email]> writes:

Dennis> Charles Hines wrote:
>> I've tried using the various PRAGMAs to help debug it (side note: the vdbe
>> ones don't seem to be working for me, even though I compiled with the
>> --enable-debug flag) as well as putting in an sqlite3 trace command that
>> dumps the strings being sent so I can watch how things are progressing, and
>> nothing odd seems to be happening that is shown at that level.
>>

Dennis> I ran into the same problem with the VDBE tracing. The configure
Dennis> script doesn't define the correct compiler flags to generate the VDBE
Dennis> trace.  The fix is detailed in this message:

Dennis>   http://www.mail-archive.com/sqlite-users@.../msg05936.html

Thanks, I'll manually add that on my next go around!

Chuck

--
Charles K. Hines                                   <[hidden email]>

     "When things don't sound evil enough on their own I like to toss in
      a BU-WHA-HA-HA-HA".                       - Catbert (from Dilbert)