#1 2014-07-05 03:39:41

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

ESQLite3Exception, 'library routine called out of sequence'

Arnaud,

I got this error in my multi-threaded program, when it happened there were multiple threads reading the DB. I use

AcquireWriteMode := amUnlocked;

since you previously suggested the unlocked mode is still thread-safe, I'm not sure if it has anything to do with the problem. Let me know if you need any other details.


Note, the stacks bellow is copied at the second debugger break, I forgot to copy the stack trace after the first debugger break.

---------------------------
Debugger Exception Notification
---------------------------
Project MyEXE.exe raised exception class ESQLite3Exception with message 'library routine called out of sequence'.
---------------------------
Break   Continue   Help   
---------------------------

SynSQLite3.sqlite3_check(63587656,21)
SynSQLite3.TSQLRequest.Prepare(63587656,'SELECT ID...')
SynSQLite3.TSQLStatementCached.Prepare('SELECT ID...')
mORMotSQLite3.TSQLRestServerDB.GetAndPrepareStatement('...')
mORMotSQLite3.TSQLRestServerDB.MainEngineList('SELECT ID...',False,nil)
mORMot.TSQLRestServerURIContext.ExecuteORMGet
mORMot.TSQLRestServerURIContext.Execute(execORMGet)
mORMot.TSQLRestServer.URI($D5CFC2F)
mORMotSQLite3.TSQLRestClientDB.InternalURI($D5CFC2F)
mORMot.TSQLRestClientURI.URI('root','GET',$D5CFCD0 {''},nil {''},$D5CFCEC {'SELECT ID...'})
mORMot.TSQLRestClientURI.ExecuteList((...),'SELECT ID...')
mORMot.TSQLRest.MultiFieldValues(TSQLMail,'ID...')
mORMot.TSQLRest.MultiFieldValues(TSQLMail,'ID...',(...))

Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2014-07-05 05:58:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: ESQLite3Exception, 'library routine called out of sequence'

In TSQLRestServerDB.MainEngineList() there are a global lock, as with any other method of mORMotSQlite3.pas:

  DB.LockJSON()..
  try
    ..
  finally
    DB.UnLockJSON();
  end;

So there is no reason why there should be a multi-thread problem.

Are using some backup method during process?
In general, is there anything outside basic CRUD operation within the ORM methods?
Do you call the SQlite3 engine directly?

Offline

#3 2014-07-05 07:37:37

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: ESQLite3Exception, 'library routine called out of sequence'

ab, There was not backup process, and I did not call the sqlite engine directly, everything goes through the TSQLRestClientDB methods. PS, the WALMode is enabled.

And I couldn't catch you about your question: "is there anything outside basic CRUD operation within the ORM methods?"

The error happened only once, I'll report if I'll get any new details.

Last edited by edwinsn (2014-07-05 07:38:31)


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB