#1 2018-02-15 15:11:45

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Error serialization obj.dyn.array in interfaced based service argument

Hi @ab, I can reproduce my problem using sample 14-Interface based service. The test case it's in https://drive.google.com/open?id=1UUGBH … lbv0o8njks.

I added

function TestObjArray(const aObjArray: TTestObjArray): RawUTF8;

to TServiceCalculator interface service. You can see that the service receives empty aObjArray values (but the length is correct) when the client sent with data.

Please, can you see this issue.

Thanks in advance.


Esteban

Offline

#2 2018-02-15 19:16:56

jaclas
Member
Registered: 2014-09-12
Posts: 215

Re: Error serialization obj.dyn.array in interfaced based service argument

Please read near topic: https://synopse.info/forum/viewtopic.php?id=4252

Maybe you encountered the same issue descripted in this topic...

Offline

#3 2018-02-15 19:25:41

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

I don't think so, my problem is with dynamic arrays as parameter in interface based service, this was working.


Esteban

Offline

#4 2018-02-16 07:29:36

wloochacz
Member
Registered: 2015-01-03
Posts: 45

Re: Error serialization obj.dyn.array in interfaced based service argument

For me, works fine:
mormot-forum-4401.gif

Last edited by wloochacz (2018-02-16 07:30:18)

Offline

#5 2018-02-16 09:02:28

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

Re: Error serialization obj.dyn.array in interfaced based service argument

@EMartin
Which compiler are you using?

Offline

#6 2018-02-16 10:11:43

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

@ab I am using Delphi 7 and I cloned the last version of the repository.


Esteban

Offline

#7 2018-02-16 10:40:47

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

@woolachz do you have the last commit (4299) ?


Esteban

Offline

#8 2018-02-16 14:05:29

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

@ab, can you reproduce this issue with the sample app. ? I tried with older commits but the error persist. The log in the sample app. show this:

...
20180216 13582123  $  +    mORMot.TSQLRestServerFullMemory(0458F670).URI(POST root/Calculator.TestObjArray?session_signature=523e3fda0007e3ac5b7620eb inlen=21)
20180216 13582123  $ auth  	TSQLRestRoutingREST(04AE7420) User/1379811290 127.0.0.1
20180216 13582123  $ call  	mORMot.TSQLRestServerFullMemory(0458F670) ICalculator.TestObjArray[[76976416,76976512]] *** THIS IS THE ERROR ***
20180216 13582123  $ EXCOS 	EAccessViolation (C0000005) at 004C7788  stack trace 00402F11 0043EA3A 0043DAD1 0043DB9D 0043DDA6 004B45D0 77930637 00402E8C 00402F11 0040667B 004047E6 004B354D 004B1E52 746C7573 00402E8C 0040532D 00405370 00427244 75636C61 7796E7DC 74AB9BA2 74AB9BB3 74AB9AB8 74B21B72 00403460 0040366B 0044648F 00402EB7 00405279 00452CA7 
20180216 13582124  $ EXCOS 	EAccessViolation (C0000005) at 004C7788  stack trace 00402EB7 00483978 004C6991 004BB8B5 004C011E 00420C57 004051FE 76288654 77964A77 77964A47 

The AV are when the method in the server side try access to array elements.

I am worry about this behavior, I never had it before.

Thanks.


Esteban

Offline

#9 2018-02-16 14:56:35

wloochacz
Member
Registered: 2015-01-03
Posts: 45

Re: Error serialization obj.dyn.array in interfaced based service argument

EMartin wrote:

@woolachz do you have the last commit (4299) ?

Delphi XE and very, very old mORMot - 1.18?

BTW - how to check the version of the mORMot? ;-)

Offline

#10 2018-02-16 15:15:00

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

@wloochacz, in SynopseCommit.inc it's the numerical version (latest is 4299).

Please, can you try the app. with latest commit ?

Thanks.


Esteban

Offline

#11 2018-02-17 12:49:45

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

Re: Error serialization obj.dyn.array in interfaced based service argument

You need to register the ObjArray before registering the Interface, otherwise the dynamic array parameter is not known as a ObjArray:

  TJSONSerializer.RegisterObjArrayForJSON(TypeInfo(TTestObjArray), TTestObjArrayElem); // do it FIRST
  TInterfaceFactory.RegisterInterfaces([TypeInfo(ICalculator)]);

Offline

#12 2018-02-17 13:38:58

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

Thanks @ab, I'll try this but it's strange that @wloochacz this works.


Esteban

Offline

#13 2018-02-26 14:49:41

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Error serialization obj.dyn.array in interfaced based service argument

@ab, changing the order works fine, seems to be that there was some change affecting this.

Thanks for the solution.


Esteban

Offline

Board footer

Powered by FluxBB