we're currently having problems with our application (written in Delphi 2006) which uses Zeos 6.6.6 to implement a temporary data buffer in a sqLite file.
Generally the program works fine, except for some rare circumstances in which many (hundreds) consecutive Insert/Select queries are executed and an Access Violation occurs.
This happens irregularly; sometimes the app crashes at the 1000th query, sometimes earlier and sometimes it works without any errors (while processing the same data in all scenarios). Pressing the 'break' button we end up in Borland's GETMEM.INC which doesn't help much in finding the cause of the exception.
Some might think of multiple threads trying to read/write to the same connection / file at the same time, but that is not the case. It is a single thread having its own TZConnection and TZQuery objects accessing its 'own' file.
The call stacks basically show two different scenarios, both ending up in Zeos objects apparently causing the AV:
- while preparing to write to the DB
Code: Select all
:775642eb kernel32.RaiseException + 0x58 System.SysGetMem(???) ZSqlStrings.TZSQLStrings.RebuildAll ZSqlStrings.TZSQLStrings.Changed Classes.TStringList.SetUpdateState(False) Classes.TStrings.EndUpdate Classes.TStrings.SetTextStr('INSERT INTO bla bla;') uGP_DS_MessageBuffer.TMessageBuffer.WriteRecord('Some more parameters, none of them empty or nil') uGP_DS_MessageBuffer.TMessageBuffer.InsertDataMessage('Some parameters, none of them empty or nil') uGP_DS_Main.TDSMain.wmWriteDataMessageToBuffer((33179, 75168960, 0, 0, 64704, 1146, 0, 0, 0, 0)) uGP_DS_Main.TDSMain.WndProc((33179, 75168960, 0, 0, 64704, 1146, 0, 0, 0, 0)) Classes.StdWndProc(788526,33179,75168960,0) uGP_DS_Main.TDSMain.ProcessMessages uGP_DS_Main.TDSMain.OnReadTimerTick($47ED428) (...)
- after reading from DB and processing the results
Code: Select all
:762442eb kernel32.RaiseException + 0x58 :004048C8 System::NotifyNonDelphiException() :77339b6b ntdll.RtlRaiseStatus + 0x86 System.SysGetMem(???) :773399f7 ntdll.KiUserExceptionDispatcher + 0xf Classes.TStream.ReadBuffer((no value),911) ZDbcResultSet.TZAbstractBlob.CreateWithStream($2851CF0) ZDbcSqLiteResultSet.TZSQLiteResultSet.GetBlob(5) ZDbcCachedResultSet.TZCachedResultSet.Fetch ZDbcCachedResultSet.TZCachedResultSet.FetchAll ZDbcCachedResultSet.TZCachedResultSet.Last ZDbcSqLiteStatement.TZSQLiteStatement.CreateResultSet('SELECT something something;'#$D#$A,$4A77518,7,$48AFED8,$28965C8) ZDbcSqLiteStatement.TZSQLiteStatement.ExecuteQuery('SELECT something something;'#$D#$A) ZDbcStatement.TZEmulatedPreparedStatement.ExecuteQuery('SELECT something something;'#$D#$A) ZDbcStatement.TZEmulatedPreparedStatement.ExecuteQueryPrepared ZAbstractRODataset.TZAbstractRODataset.CreateResultSet('SELECT something something'#$D#$A,-1) ZAbstractDataset.TZAbstractDataset.CreateResultSet('SELECT something something'#$D#$A,-1) ZAbstractRODataset.TZAbstractRODataset.InternalOpen DB.TDataSet.DoInternalOpen DB.TDataSet.OpenCursor(False) DB.TDataSet.SetActive(True) DB.TDataSet.Open uGP_DS_MessageBuffer.TMessageBuffer.ReadNextUnprocessedDataMessage(Some parameters none of them empty or nil) uGP_DS_Main.TDSMain.OnReadTimerTick($48AB740) (...)
Has anyone an idea what the problem might be? Any hints greatly appreciated!
Cheers