#1 2017-03-22 08:13:20

cybexr
Member
Registered: 2016-09-14
Posts: 40

TestSQL3 compiled by newpascal running on linux64 failed

it seems backup feature on linux goes wrong,

below is TestSQL3 with verbose-log opened:

/media/sf_dev/lib/SQLite3/fpc/bin/x86_64-linux/TestSQL3 0.0.0.0 (2017-03-22 15:55:47)
Host=sa-VirtualBox User=sa CPU=0:FFFB8B070B22F8DE0020040000 OS=Linux-4.4.0-66-generic#87-Ubuntu-SMP-Fri-Mar-3-15:29:05-UTC-2017 Wow64=0 Freq=1000000000
TSQLLog 1.18.3470 FTS3 2017-03-22T07:57:59

20170322 07575933  !  +    Low level common - System copy record
.... 
...bla bla
...
20170322 07584130  ! DB            SynSQLite3.TSQLDatabase(00007F79231C8080) "backupbackgroundTTestFileBased.dbsynlz" database file opened with PageSize=4096 and CacheSize=10000
20170322 07584130  !  -        00.045.642
20170322 07584131  # info  SetThreadName 00007F792463E700=TSQLDatabaseBackupThread "test.db3" "backupbackgroundTTestFileBased.dbsynlz"
20170322 07584131  # trace {"TSQLDatabaseBackupThread(00007F79299D5440)":{}}.Execute Step=backupStart ToFinish=0
20170322 07584131  # trace {"TSQLDatabaseBackupThread(00007F79299D5440)":{}}.Execute Step=backupStepBusy ToFinish=0
20170322 07584131  # trace {"TSQLDatabaseBackupThread(00007F79299D5440)":{}}.Execute Step=backupStepBusy ToFinish=0

... then infinite loop

Offline

#2 2017-03-28 02:42:50

cybexr
Member
Registered: 2016-09-14
Posts: 40

Re: TestSQL3 compiled by newpascal running on linux64 failed

After 5-days of digging into sources,  the problem is occured because of a missing trasaction rollback, so the later Test-backup will wait infinite .

SynSelfTests.pas :

  TTestSQLite3Engine = class(TSynTestCase)   
    procedure _TSQLRestClientDB;
...
line-13022         Client.Commit;   //here will throw a exception,  but didn't catch by line-13032- Client.RollBack;   

have no idea how to solve it , @ab, pls help

Offline

#3 2017-03-28 06:55:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,591
Website

Re: TestSQL3 compiled by newpascal running on linux64 failed

The Rollback should take place in the except Rollback; end; block, I guess, in such cases.
What is the exact problem?

Offline

#4 2017-03-28 12:10:12

cybexr
Member
Registered: 2016-09-14
Posts: 40

Re: TestSQL3 compiled by newpascal running on linux64 failed

In my enviorment, Ubuntu16.04 64bit,  during the  TTestFileBased._TSQLRestClientDB proc,

TestVirtual(Client,true,'Direct Virtual Table access',TSQLRecordDali1);   //=// in this sub-procedure, while executing Client.Commit;  will got an Exception : EFCreateError,  then, rollback exeuted;
TestVirtual(Client,true,'Direct Virtual Table access',TSQLRecordDali2);   //=// same as previous sub-procedure

then the code goes on like this:

if Client.TransactionBegin(TSQLRecordPeopleObject) then
try
...
  Client.Commit;  //=// but , here the EFCreateError will occur, and Exception didn't catched by the try...except..end block
...
except
  Client.RollBack;  //=// will not Executed , so the later backup will wait infinite.
end;       


here comes some Testlog:

20170327 08170805  ! fail  	SynSelfTests.TTestFileBased(00007F8CD480B400) File based: TSQLRestClientDB ""
20170327 08170805  !  +    	SynSelfTests.TSQLRestServerTest(00007F8CD47BB090).URI(END root?session_signature=3072653700016E7B46087318 inlen=0)
20170327 08170805  ! auth  		mORMot.TSQLRestRoutingREST(00007F8CD3343A70) User/812803383 127.0.0.1
20170327 08170806  ! debug 		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) TSQLRestRoutingREST.Error: {  "errorCode":500,  "error":  {"EORMException":{   "ClassName":"EORMException",   "Address":"00007F8CD32E0CC0",   "Message": "Deleting and again creating existing file error. Failure in TSQLRestStorageInMemoryExternal.UpdateFile(Dali1.json) due to EFCreateError"  }}  }
20170327 08170806  ! srvr  		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) User 127.0.0.1 END root/ ORM-Write -> 500 with outlen=270 in  us
20170327 08170806  !  -    	00.004.997
20170327 08170806  ! ERROR 	mORMotSQLite3.TSQLRestClientDB(00007F8CD47BADF0) END root returned 500 (Internal Server Error) with message  {  "errorCode":500,  "error":  {"EORMException":{   "ClassName":"EORMException",   "Address":"00007F8CD32E0CC0",   "Message": "Deleting and again creating existing file error. Failure in TSQLRestStorageInMemoryExternal.UpdateFile(Dali1.json) due to EFCreateError"  }}  }
20170327 08170806  !  +    	SynSelfTests.TSQLRestServerTest(00007F8CD47BB090).URI(ABORT root?session_signature=3072653700016E7B46087318 inlen=0)
20170327 08170806  ! auth  		mORMot.TSQLRestRoutingREST(00007F8CD3343A70) User/812803383 127.0.0.1
20170327 08170806  ! SQL   		SynSQLite3.TSQLDatabase(00007F8CD48B4240) 27us test.db3 ROLLBACK TRANSACTION;
20170327 08170806  ! srvr  		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) User 127.0.0.1 ABORT root/ ORM-Write -> 200 with outlen=0 in  us
20170327 08170806  !  -    	00.000.066

blablabal


20170327 08170806  ! fail  	#5709 
20170327 08170806  ! fail  	SynSelfTests.TTestFileBased(00007F8CD480B400) File based: TSQLRestClientDB ""
20170327 08170806  !  +    	SynSelfTests.TSQLRestServerTest(00007F8CD47BB090).URI(END root?session_signature=3072653700016E7B46087318 inlen=0)
20170327 08170806  ! auth  		mORMot.TSQLRestRoutingREST(00007F8CD47DBEB0) User/812803383 127.0.0.1
20170327 08170806  ! debug 		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) TSQLRestRoutingREST.Error: {  "errorCode":500,  "error":  {"EORMException":{   "ClassName":"EORMException",   "Address":"00007F8CD474F980",   "Message": "Deleting and again creating existing file error. Failure in TSQLRestStorageInMemoryExternal.UpdateFile(Dali1.json) due to EFCreateError"  }}  }
20170327 08170806  ! srvr  		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) User 127.0.0.1 END root/ ORM-Write -> 500 with outlen=270 in  us
20170327 08170806  !  -    	00.000.839
20170327 08170806  ! ERROR 	mORMotSQLite3.TSQLRestClientDB(00007F8CD47BADF0) END root returned 500 (Internal Server Error) with message  {  "errorCode":500,  "error":  {"EORMException":{   "ClassName":"EORMException",   "Address":"00007F8CD474F980",   "Message": "Deleting and again creating existing file error. Failure in TSQLRestStorageInMemoryExternal.UpdateFile(Dali1.json) due to EFCreateError"  }}  }
20170327 08170807  ! DB    	mORMot.TSQLRestStorageInMemoryExternal(00007F8CD481B8C0) UpdateFile(Dali2) done in 4.29ms
20170327 08170807  !  +    	SynSelfTests.TSQLRestServerTest(00007F8CD47BB090).URI(BEGIN root/PeopleObject?session_signature=3072653700016E7B82734DC2 inlen=0)
20170327 08170807  ! auth  		mORMot.TSQLRestRoutingREST(00007F8CD47DBEB0) User/812803383 127.0.0.1
20170327 08170807  ! SQL   		SynSQLite3.TSQLDatabase(00007F8CD48B4240) 23us test.db3 ROLLBACK TRANSACTION;
20170327 08170807  ! SQL   		SynSQLite3.TSQLDatabase(00007F8CD48B4240) 8us test.db3 BEGIN TRANSACTION;

blabla

20170327 08170807  !  +    	SynSelfTests.TSQLRestServerTest(00007F8CD47BB090).URI(END root?session_signature=3072653700016E7B46087318 inlen=0)
20170327 08170807  ! auth  		mORMot.TSQLRestRoutingREST(00007F8CD47DBEB0) User/812803383 127.0.0.1
20170327 08170807  ! debug 		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) TSQLRestRoutingREST.Error: {  "errorCode":500,  "error":  {"EORMException":{   "ClassName":"EORMException",   "Address":"00007F8CD32E3540",   "Message": "Deleting and again creating existing file error. Failure in TSQLRestStorageInMemoryExternal.UpdateFile(Dali1.json) due to EFCreateError"  }}  }
20170327 08170807  ! srvr  		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) User 127.0.0.1 END root/ ORM-Write -> 500 with outlen=270 in  us
20170327 08170807  !  -    	00.002.364
20170327 08170807  ! ERROR 	mORMotSQLite3.TSQLRestClientDB(00007F8CD47BADF0) END root returned 500 (Internal Server Error) with message  {  "errorCode":500,  "error":  {"EORMException":{   "ClassName":"EORMException",   "Address":"00007F8CD32E3540",   "Message": "Deleting and again creating existing file error. Failure in TSQLRestStorageInMemoryExternal.UpdateFile(Dali1.json) due to EFCreateError"  }}  }
20170327 08170807  !  +    	SynSelfTests.TSQLRestServerTest(00007F8CD47BB090).URI(GET root?session_signature=3072653700016E7B46087318 inlen=104)
20170327 08170807  ! auth  		mORMot.TSQLRestRoutingREST(00007F8CD47DBEB0) User/812803383 127.0.0.1
20170327 08170807  ! SQL   		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) 131us returned 11 rows as 1123 bytes SELECT ID,FirstName,LastName,YearOfBirth,YearOfDeath,PeopleID,People,PeopleCascade,GUID FROM CustomProps
20170327 08170807  ! res   		SynSQLite3.TSQLDatabase(00007F8CD48B4240) {"fieldCount":9,"values":["ID","FirstName","LastName","YearOfBirth","YearOfDeath","PeopleID","People","PeopleCascade","GUID",1,"Samuel Finley Breese1","Morse",1791,1872,0,0,0,"00000001-0000-0000-0000-000000000000",2,"Samuel Finley Breese1","Morse",1791,1872,0,0,0,"00000002-0000-0000-0000-000000000000",3,"Samuel Finley Breese2","Morse",1791,1872,0,0,0,"00000003-0000-0000-0000-000000000000",4,"Samuel Finley Breese3","Morse",1791,1872,0,0,0,"00000004-0000-0000-0000-000000000000",5,"Samuel Finley Breese4","Mors... (truncated) length=1123
20170327 08170807  ! srvr  		SynSelfTests.TSQLRestServerTest(00007F8CD47BB090) User 127.0.0.1 GET root/ ORM-Get -> 200 with outlen=1123 in  us
20170327 08170807  !  -    	00.000.256
20170327 08170807  ! DB    	SynSQLite3.TSQLDatabase(00007F8CD48B4240) BackupBackground("backupbackgroundTTestFileBased.dbsynlz") started on test.db3
20170327 08170807  !  +    	SynSQLite3.TSQLDatabase(00007F8CD330A780).DBOpen backupbackgroundTTestFileBased.dbsynlz
20170327 08170808  ! SQL   		SynSQLite3.TSQLDatabase(00007F8CD330A780) 14us backupbackgroundTTestFileBased.dbsynlz PRAGMA page_size=4096

Offline

#5 2017-03-28 14:10:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,591
Website

Re: TestSQL3 compiled by newpascal running on linux64 failed

May be something diverse in FPC than in Delphi, in the except...end block.

What if you try:

except
  on Exception do // explicit
    Client.RollBack;  
end;       

Offline

#6 2017-03-28 15:12:37

cybexr
Member
Registered: 2016-09-14
Posts: 40

Re: TestSQL3 compiled by newpascal running on linux64 failed

Tryed, but the same result.

AND finally, maybe it's my fault,  my Ubuntu runs in VirtualBox which hosted on windows-laptop.  I created a "shared folder" between host&VM,  which maps D:\DEV\lib to /media/sf_dev/lib/, and I run the compilation-result-executable in the shared folder. 
BUT, if copy the executable to anyother dir, the problem disapear, Virtualtable write OK with no EFCreateError.
SO, still don't know why shared-folder makes so much trouble, and during the TestSQL3, some temp-file created successful, ONLY when writing virtualtable(Dali1.json) goes wrong.

Hope others may notice the Virtualbox- shared folder trap.

And thanks again @ab, for your replying & your passion on this great framework !

Offline

Board footer

Powered by FluxBB