You are not logged in.
Pages: 1
Hello,
I've a very strange issue which appears after some days/weeks where my code was running fine but then suddenly it stops working because it creates a deadlock by LockJSON due to a thrown exception.
My TSQLFileStatRec class inherits from TSQLRecord and has the members declared as TSQLSitesRecord. The member classes inherit from TSQLRecordNoCase and only have following types: RawUTF8, Int64 and TDateTime.
Example class definition:
TSQLSrcRec = class(TSQLRecordNoCase)
private
FName: RawUTF8;
published
property Name: RawUTF8 read FName write FName stored AS_UNIQUE;
end;
Stacktrace when exception is thrown:
SynSQLite3.TSQLRequest.Execute(???,???,???,???)
:0000000003B03B57 ; c:\lib\sqlite3-64.dll
:0000000003B0FF16 ; c:\lib\sqlite3-64.dll
:0000000003BFB9CF ; c:\lib\sqlite3-64.dll
:0000000003C053F8 ; c:\lib\sqlite3-64.dll
:0000000003C055A8 ; c:\lib\sqlite3-64.dll
:000000000082273B TSQLRequest.Step + $4B
SynSQLite3.TSQLRequest.Step
mORMotSQLite3.TSQLRestServerDB.MainEngineList('SELECT ID FROM FileStatRec WHERE SrcRec = :(''000000000000000C''): AND DstRec = :(''000000000000000A''): AND SectRec = :(''0000000000000014''): AND FileRec = :(''000000000001E313''):',False,nil)
mORMot.TSQLRestServerURIContext.ExecuteORMGet
mORMot.TSQLRestServerURIContext.ExecuteCommand
mORMot.TSQLRestServer.URI($B3DF2E0)
mORMotSQLite3.TSQLRestClientDB.InternalURI($B3DF2E0)
mORMot.TSQLRestClientURI.OnBackgroundProcess(nil,$B3DF2E0)
mORMot.CallInternalURI
mORMot.TSQLRestClientURI.URI('root','GET',$B3DF3B8 {''},nil {''},$B3DF3E8 {'SELECT ID FROM FileStatRec WHERE SrcRec = :(''000000000000000C''): AND DstRec = :(''000000000000000A''): AND SectRec = :(''0000000000000014''): AND FileRec = :(''000000000001E313''):'})
mORMot.TSQLRestClientURI.ExecuteList((...),'SELECT ID FROM FileStatRec WHERE SrcRec = :(''000000000000000C''): AND DstRec = :(''000000000000000A''): AND SectRec = :(''0000000000000014''): AND FileRec = :(''000000000001E313''):')
mORMot.TSQLRest.MultiFieldValues(TSQLRecordClass($B96558),'ID','SrcRec = :(''000000000000000C''): AND DstRec = :(''000000000000000A''): AND SectRec = :(''0000000000000014''): AND FileRec = :(''000000000001E313''):')
mORMot.TSQLRecord.CreateAndFillPrepare($7FF4FDD4BBF0,'SrcRec = :(''000000000000000C''): AND DstRec = :(''000000000000000A''): AND SectRec = :(''0000000000000014''): AND FileRec = :(''000000000001E313''):','ID')
mORMot.TSQLRecord.CreateAndFillPrepare($7FF4FDD4BBF0,'SrcRec = ? AND DstRec = ? AND SectRec = ? AND FileRec = ?',(...),'ID')
MyFile.AddFile('SrcName','DstName','SectName','foldername','filename',size)
The code for the query is made with CreateAndFillPrepare (using TSQLRestClientDB) and the SrcRec parameter is filled with the previous created SrcRec and added as SrcRec.AsTSQLRecord. All my queries only fetch the ID value. The thrown exception is FLOAT_OVERFLOW. When I change the SrcRec.AsTSQLRecord to SrcRec.ID it doesn't throw the exception.
For me it seems it's related to SrcRec.AsTSQLRecord?
Thanks in advance and regards!
Offline
Nobody?
Offline
No because its also running on Linux where static linking isn't supported but the same issue with deadlock occur.
Offline
AsTSQLRecord can be quite buggy on Linux - especially if heap address randomization is enabled.
Just as TSQLRecord.ID/GetID may be too.
So using PtrInt(strRec) directly - if you know it is not an instance, but a pointer - is certainly the safest option.
Offline
Static linking works very well on Linux with FPC... Or are you using Kylix?
No, using FPC. I think I've read somewhere that static linking doesn't work with FPC.
But however, why should it make a difference?
I'm using the SQLite precompiled Binaries from https://www.sqlite.org/ on Windows and for Linux we compile them.
Offline
AsTSQLRecord can be quite buggy on Linux - especially if heap address randomization is enabled.
Just as TSQLRecord.ID/GetID may be too.So using PtrInt(strRec) directly - if you know it is not an instance, but a pointer - is certainly the safest option.
So you mean the call to
mORMot.TSQLRecord.CreateAndFillPrepare($7FF4FDD4BBF0,'SrcRec = ? AND DstRec = ? AND SectRec = ? AND FileRec = ?',(...),'ID')
should be made with PtrInt(SrcRec) instead of SrcRec.AsTSQLRecord?
Could you please explain how it finds the ID inside the DB through the address pointer of a variable?
Last edited by urhen (2020-02-17 17:08:43)
Offline
Pages: 1