#1 2019-09-22 11:25:20

Daniel
Member
Registered: 2016-12-08
Posts: 23

Bug in param matching in remote interface invokation

I'm using WebSockets for remote interface calls and think I have found a bug.

So given these types:

TClientID = TGUID;
TSessionID = Int64;
IOSSCallback = invokable interface

I had this method in interface:

function SubscribeToOss(const ACallback: IOSSCallback; const AClientID: TClientID: TSessionId;

Which worked fine, then I extended the params to:

function SubscribeToOss(const ACallback: IOSSCallback; const AClientID: TClientID; const AComputer: string; const AApplicationName: string; const AUserName: string): TSessionId;

And of course recompiled both sides, but Server raises:
IOSSService.SubscribeToOss failed on AComputer:string [missing or invalid value]

Which is not true, the AComputer params is present, but there seems to be a bug in server in param matching.

Then I changed the signature again, just rearranged the order of params into this:

function SubscribeToOss(const AComputer: string; const AApplicationName: string; const AClientID: TClientID; const ACallback: IOSSCallback): TSessionId;

And now it works fine again.

So the problem has something to do with order of params, in particular, having String after Interface or GUID.

I could investigate more, but hope this is enough info for you guys to find the bug.

Offline

#2 2019-09-22 13:37:14

Vitaly
Member
From: UAE
Registered: 2017-01-31
Posts: 168
Website

Re: Bug in param matching in remote interface invokation

Did you try to use RawUTF8 instead of string type?

Offline

#3 2019-09-22 18:26:18

Daniel
Member
Registered: 2016-12-08
Posts: 23

Re: Bug in param matching in remote interface invokation

It's not string that is the problem, it's the GUID.

It turns out the last signature I posted doesn't work either, but doesn't raise an exception, instead the CallBack param is always nil.

So it's this const AClientID: TClientID that doesn't work

TClientID is a TGUID which is a record:

  TGUID = record
    D1: Cardinal;
    D2: Word;
    D3: Word;
    D4: array[0..7] of Byte;
  end;

From my limited debugging it seems that it fails to read record correctly but this is not detected correctly so it raise exception on following parameter in case of string, or doesn't raise anything at all in case of interface param.

Offline

#4 2019-09-23 05:50:29

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 211

Re: Bug in param matching in remote interface invokation

records need to be declared as packed record, see documentation on Record serialization

Offline

#5 2019-09-23 07:54:25

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

Re: Bug in param matching in remote interface invokation

And there is native TGUID support, so you could use it conveniently in a text record serialization definition.

Offline

Board footer

Powered by FluxBB