#1 Yesterday 08:33:06

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 527

Access violation error after commit 4fad13563

Since commit 4fad13563f6769b475a77f6f162f5a4253c94998 I am getting a Access violation error in line 5448 of mormot.core.json using win64 Delphi 13.1. The stack follows:

_JS_Ansi('',(W=($0000011D0D18EC70,TOnTextWriterFlush @ 0x0000011d0e4a6490,$0000011D0E802E40,8192,0,0,0,[twoForceJsonStandard],[twfDestIsOwnedStream,twfRawByteStringStream],0,$0000011D0E802E9C,$0000011D0E804E30,??,nil,nil),Info=(??,ptRawUtf8,pctNone,[rcfIsManaged,rcfJsonString,rcfMultiLineStrings],nil,nil,$00007ff7c83036e0,$00007ff7c8303dc0,??,??,??,$00007ff7c8303980,ptNone,ptNone,$00007ff7c836f820,$00007ff7c83686f0,??,??,??,??,??,??,??,??,??,$0000000000000000,nil,nil)))
_JS_DynArray($0000000000000008,(W=($FFFFFFFFFFFFFFFF,TOnTextWriterFlush @ 0xec83485356575551,$FFFFFFFFFFFFFFFF,,,,,TTextWriterOptions @ 0xec83485356575581,TTextWriterFlags @ 0xec83485356575583,,$FFFFFFFFFFFFFFFF,$FFFFFFFFFFFFFFFF,??,$FFFFFFFFFFFFFFFF,$FFFFFFFFFFFFFFFF),Info=(??,??,??,??,??,$FFFFFFFFFFFFFFFF,??,??,??,??,??,??,??,??,??,??,??,??,??,??,??,??,??,??,??,??,$FFFFFFFFFFFFFFFF,??)))
_JS_RttiCustom('',(W=??,Info=??,Prop=??,Options=(__data="",__basetype=??)))
TInterfaceMethodArgument.AddJson((ParamName=??,ArgTypeName=??,ArgRtti=??,ValueType=??,ValueDirection=??,ValueVar=??,ValueKindAsm=(__data="",__basetype=??),RegisterIdent=??,FPRegisterIdent=??,IndexVar=??,SizeInStack=??,InStackOffset=??,RawExecute=??,OffsetAsValue=??),??,??,(__data='',__basetype=??))
TInterfacedObjectFake.FakeCallGetJsonFromStack(??,(Stack=??,Method=??,Result=??,ResultType=??,ServiceCustomAnswerPoint=??,Value=(__element_ptr=([0]=??,[1]=??,[2]=??,[3]=??,[4]=??,[5]=??,[6]=??,[7]=??,[8]=??,[9]=??,[10]=??,[11]=??,[12]=??,[13]=??,[14]=??,[15]=??,[16]=??,[17]=??,[18]=??,[19]=??,[20]=??,[21]=??,[22]=??,[23]=??,[24]=??,[25]=??,[26]=??,[27]=??,[28]=??,[29]=??,[30]=??,[31]=??))),(Data=??))
TInterfacedObjectFakeClient.FakeCallGetJsonFromStack(??,(Stack=$0000001d0ceff788,Method=$0000011d7a2d7258,Result=$0000001d0ceff738,ResultType=imvNone,ServiceCustomAnswerPoint=$0000001d0ceff850,Value=([0]=$00007ff7c7e39a88,[1]=$0000001d0ceff7d0,[2]=$0000001d0ceff7d8,[3]=$0000001d0ceff7e0,[4]=$0000001d0ceff828,[5]=$0000001d0ceff7f0,[6]=$0000001d0ceff7f8,[7]=$0000001d0ceff800,[8]=$0000001d0ceff850,[9]=$0000011d7a2820c0,[10]=$0000011d7c3a5470,[11]=$0000001d0ceff8c4)),(Data=nil))
TInterfacedObjectFake.FakeCallInternalProcess((1529898381,$485356575541CCCC,$8948CB894828EC83,$8948CF894CC933D6,??,3347269881,[ifoJsonAsExtended],??,$00007FF7C843F216,$00007FF7C843F21E,??),(Stack=nil,Method=nil,Result=nil,ResultType=imvNone,ServiceCustomAnswerPoint=$0000000000000005,Value=([0]=$0000001d0ceff7c0,[1]=$00007ff7c947660d,[2]=$0000011d0e4a6520,[3]=$0000001d0ceff850,[4]=$00490010a0000002,[5]=nil,[6]=$0000000000000001,[7]=$0000001d0ceff828,[8]=nil,[9]=nil,[10]=$0000011d0d40e628,[11]=$00007ff70001d4c0,[12]=$0000001d0000ea60,[13]=nil)))
TInterfacedObjectFakeRaw.FakeCall(??,$0000001d0ceff788)
x64FakeStub

Offline

#2 Yesterday 09:53:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,482
Website

Re: Access violation error after commit 4fad13563

Please don't post stack traces like that directly.
There is not enough information, and it is filling the forum DB for no benefit.

What is the context?
Please create a gist with
- the interface method involved
- the transmitted JSON involved

Aren't you mixing string types and codepages in your client code?
What are rec^.length and rec^.codepage values?

The line 5448 should not be compiled at all under Delphi 13.1.
Debug a little more and find out where is the actual issue.

Offline

#3 Yesterday 11:03:19

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 527

Re: Access violation error after commit 4fad13563

ab wrote:

What is the context?
Please create a gist with
- the interface method involved
- the transmitted JSON involved

Aren't you mixing string types and codepages in your client code?

No, as far as I can understand the question

ab wrote:

What are rec^.length and rec^.codepage values?

Debugger in delphi can not provide this and I believe rec does not correct point to memory

ab wrote:

The line 5448 should not be compiled at all under Delphi 13.1.
Debug a little more and find out where is the actual issue.

https://gist.github.com/dkounal/913a3fa … 355ec8ced5

Last edited by dcoun (Yesterday 11:08:06)

Offline

#4 Today 13:06:34

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 527

Re: Access violation error after commit 4fad13563

I found a solution. It simply needs to avoid rawutf8 as type in records that will be used as parameters in this interface.
Replacing rawutf8 with utf8string works ok. Probably it is a compiler problem from Delphi 13.1

Offline

#5 Today 13:24:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,482
Website

Re: Access violation error after commit 4fad13563

But RawUtf8 is in fact Utf8String...
In practice, TypeInfo(RawUtf8) = TypeInfo(System.UTF8String) so there should be no difference!

Weird that we can't reproduce it...

Offline

#6 Today 13:25:48

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 527

Re: Access violation error after commit 4fad13563

I have not managed to reproduce it and I am really in a hurry these days.
Thank you a lot for your time.

Offline

#7 Today 18:03:23

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 527

Re: Access violation error after commit 4fad13563

ab wrote:

Weird that we can't reproduce it...

I could not resist....

https://gist.github.com/dkounal/3fd7bff … ce3175e764

it reproduces the problem

Offline

#8 Today 18:57:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,482
Website

Re: Access violation error after commit 4fad13563

tarray<rawutf8> generics syntax should indeed be supported.

There was an issue to be fixed:
https://github.com/synopse/mORMot2/commit/9a7ae37f1

Offline

#9 Today 19:15:29

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 527

Re: Access violation error after commit 4fad13563

Thanks a lot Arnaud
So, this declaration in the rtti caused the problem.
Is it possible to be warned for such errors before I find errors in other place of the code?

Offline

Board footer

Powered by FluxBB