#1 2022-04-28 14:15:12

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

AV in Delphi 11.1 Patch1 Win64

mORMot 1.18 r6382
After Delphi 11.1 Patch1, TestSQL3.exe Win64 ends with AV (in Section 2.10).
Win32 works.
Maybe this is related to the change of AtomicCmpExchange128 to system.pas?
End of log file:

20220428 15024508 fail  SynSelfTests.TTestBasicClasses(02b16ad5ca00) Basic classes - TSQLRestServerFullMemory [] stack trace API e50262 e76b57 e73ebd 0137170d e74f93 013eaf0e 013eb273 013eb484 7ffdfbba7034 7ffdfd7e2651 
20220428 15024755 EXCOS EAccessViolation (c0000005) [] at f49ba6 
20220428 15024755 fail  #2  stack trace API e51166 e73e94 013a00fd 013a372c e74f93 013eaf0e 013eb273 013eb484 7ffdfbba7034 7ffdfd7e2651 
20220428 15024755 fail  SynSelfTests.TTestClientServerAccess(02b16ace00d0) Client server access - Local window messages [] stack trace API e50262 e76b57 e73ebd 013a00fd 013a372c e74f93 013eaf0e 013eb273 013eb484 7ffdfbba7034 7ffdfd7e2651 
20220428 15032924 EXCOS EAccessViolation (c0000005) [] at f49ba6

Michał

Last edited by miab3 (2022-04-28 14:51:24)

Offline

#2 2022-04-28 15:35:09

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

Re: AV in Delphi 11.1 Patch1 Win64

Could you enable the detailed map file in the project Options, so that the stack trace has the source line numbers?

We don't use AtomicCmpExchange128() anywhere in mORMot, IIRC.

What does Delphi 11.1 before the patch do?
I only have up to Delphi 10.4 here and I have no trouble on Win64.

Online

#3 2022-04-29 12:22:34

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: AV in Delphi 11.1 Patch1 Win64

End of log:

20220429 13073415 fail  SynSelfTests.TTestBasicClasses(02204c3d4bc0) Basic classes - TSQLRestServerFullMemory [] stack trace API dd6b57 SynTests.TSynTestsLogged.AddFailed (1259) dd3ebd SynTests.TSynTestCase.TestFailed (860) 01282109 SynSelfTests.TSQLRecordTest.CheckWith (7100) 012d16b5 SynSelfTests.TTestBasicClasses._TSQLRestServerFullMemory (11288) dd4f93 SynTests.TSynTests.Run (1033) 0134af0e mORMotSelfTests.TTestSynopsemORMotFramework.Run (108) 0134b273 mORMotSelfTests.SQLite3ConsoleTests (183) 0134b484 TestSQL3 (208) 
20220429 13073415 fail  #551025  stack trace API dd3e94 SynTests.TSynTestCase.TestFailed (858) 012d170d SynSelfTests.TTestBasicClasses._TSQLRestServerFullMemory (11303) dd4f93 SynTests.TSynTests.Run (1033) 0134af0e mORMotSelfTests.TTestSynopsemORMotFramework.Run (108) 0134b273 mORMotSelfTests.SQLite3ConsoleTests (183) 0134b484 TestSQL3 (208) 
20220429 13073415 fail  SynSelfTests.TTestBasicClasses(02204c3d4bc0) Basic classes - TSQLRestServerFullMemory [] stack trace API dd6b57 SynTests.TSynTestsLogged.AddFailed (1259) dd3ebd SynTests.TSynTestCase.TestFailed (860) 012d170d SynSelfTests.TTestBasicClasses._TSQLRestServerFullMemory (11303) dd4f93 SynTests.TSynTests.Run (1033) 0134af0e mORMotSelfTests.TTestSynopsemORMotFramework.Run (108) 0134b273 mORMotSelfTests.SQLite3ConsoleTests (183) 0134b484 TestSQL3 (208) 
20220429 13073705 EXCOS EAccessViolation (c0000005) [] at ea9ba6 mORMot.TSQLRestServer.AnswerToMessage (38148) 
20220429 13073705 fail  #2  stack trace API dd3e94 SynTests.TSynTestCase.TestFailed (858) 013000fd SynSelfTests.TTestClientServerAccess.ClientTest (15198) 0130372c SynSelfTests.TTestClientServerAccess.LocalWindowMessages (15474) dd4f93 SynTests.TSynTests.Run (1033) 0134af0e mORMotSelfTests.TTestSynopsemORMotFramework.Run (108) 0134b273 mORMotSelfTests.SQLite3ConsoleTests (183) 0134b484 TestSQL3 (208) 
20220429 13073705 fail  SynSelfTests.TTestClientServerAccess(02204bb67100) Client server access - Local window messages [] stack trace API dd6b57 SynTests.TSynTestsLogged.AddFailed (1259) dd3ebd SynTests.TSynTestCase.TestFailed (860) 013000fd SynSelfTests.TTestClientServerAccess.ClientTest (15198) 0130372c SynSelfTests.TTestClientServerAccess.LocalWindowMessages (15474) dd4f93 SynTests.TSynTests.Run (1033) 0134af0e mORMotSelfTests.TTestSynopsemORMotFramework.Run (108) 0134b273 mORMotSelfTests.SQLite3ConsoleTests (183) 0134b484 TestSQL3 (208) 
20220429 13081812 EXCOS EAccessViolation (c0000005) [] at ea9ba6 mORMot.TSQLRestServer.AnswerToMessage (38148)

I think AV pops up after this:

 2.10. Multi thread process:
  - Create thread pool: 1 assertion passed  1.89ms
  - TSQLRestServerDB: 4,822 assertions passed  1.55s
     1=16539/s  2=12833/s  5=5133/s  10=2563/s  30=853/s  50=512/s
  - TSQLRestClientDB: 4,822 assertions passed  1.56s
     1=16305/s  2=12846/s  5=5131/s  10=2561/s  30=853/s  50=512/s
  - TSQLRestClientURINamedPipe: 2,412 assertions passed  1.48s
     1=1372/s  2=992/s  5=728/s

Michał

Offline

#4 2022-04-29 12:40:12

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

Re: AV in Delphi 11.1 Patch1 Win64

I don't have Delphi 11, so I can't reproduce the issue, sadly.

No problem with Delphi 10.4 AFAIK.

Online

#5 2023-03-07 09:54:14

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: AV in Delphi 11.1 Patch1 Win64

Offline

#6 2023-03-07 11:20:13

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

Re: AV in Delphi 11.1 Patch1 Win64

I don't understand what

end align {$IFDEF CPU64BITS} 16 {$ELSE !CPU64BITS} 8 {$ENDIF CPU64BITS};

means in practice.

Since I don't have access to the system.pas source code, it is impossible for me to find out what changed.

Online

#7 2023-03-14 21:21:52

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: AV in Delphi 11.1 Patch1 Win64

I think I found the AV reason for Delphi 11.1 sp1 Win64.
When ASLR is disabled, the error does not occur.
Here's more about it:
https://blogs.embarcadero.com/rad-studi … ity-flags/
https://en.delphipraxis.net/topic/6627- … ker-flags/
https://quality.embarcadero.com/browse/RSP-38488
"...It seems that casting as Integer worked while ASLR was disabled. Returned NativeUInt was probably < Max(Int). ASLR is now enabled by default (11.1)."

and

"There is a systematic crash here with Delphi 11.2 64 bit because of changes in ASLR support.
Please change in Vcl.Shell.ShellCtrls the types of TCustomShellTreeView.FImages, TCustomShellComboBox.FImages, TCustomShellListView.FLargeImages
and TCustomShellListView.FSmallImages from Integer to THandle"

Last edited by miab3 (2023-03-15 07:20:14)

Offline

#8 2023-03-15 10:03:36

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: AV in Delphi 11.1 Patch1 Win64

Offline

#9 2023-03-15 10:25:57

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

Re: AV in Delphi 11.1 Patch1 Win64

In mORMot we use PtrUInt/PtrInt since years for all pointer-sized integers.

Your GPF seems to come from TSQLRestServer.AnswerToMessage in the stack trace.
But it uses a WM_COPYDATA message, which seems correctly passed from the TWMCopyData official structure in to the LParam which is pointer-sized

Note this message passing is not available in mORMot 2 any more, because it was confusing at most, even if efficient in some proprietary cases to communicate between VCL apps (but not from services, which don't access the UI message loop).

Online

Board footer

Powered by FluxBB