ClientID on server is different when 1st call is Async

codefirst
async
clientid
delphi

(Matjeschk, Peter) #1

Hello,
I just stumbled about a strange behaviour: after the creation of the DataModule, the ClientID of the Channel and Message are different. Normally this is not a problem, because if you initially call a method in sync the Message.ClientID will be set to the value of the Channel.ClientID

However, if the first call is asynchronous, the MessageID still keeps it’s original value (my guess it, that the cloned channel gets the assigned ClientID of the Message and in sync mode it is the opposite way as both objects are already existing).

On the Client:
==============
Source:
    OutputDebugString(PWideChar('1-Message.ClientID:'+GuidToString(Message.ClientID)));
    OutputDebugString(PWideChar('1-Channel.ClientID:'+GuidToString(Channel.ClientID)));
    self.LoginService_AsyncEx.BeginTestAction(DoAsyncCallback,nil);
    Sleep(2000);
    OutputDebugString(PWideChar('2-Message.ClientID:'+GuidToString(Message.ClientID)));
    OutputDebugString(PWideChar('2-Channel.ClientID:'+GuidToString(Channel.ClientID)));
    self.LoginService.TestAction;
    OutputDebugString(PWideChar('3-Message.ClientID:'+GuidToString(Message.ClientID)));
    OutputDebugString(PWideChar('3-Channel.ClientID:'+GuidToString(Channel.ClientID)));

Results in:
    1-Message.ClientID:{61683156-615B-41D1-8A7B-4C973A1DAE7D}
    1-Channel.ClientID:{56816B00-2BF0-470D-BA75-AA24F236D346}
    2-Message.ClientID:{61683156-615B-41D1-8A7B-4C973A1DAE7D}
    2-Channel.ClientID:{56816B00-2BF0-470D-BA75-AA24F236D346}
    3-Message.ClientID:{56816B00-2BF0-470D-BA75-AA24F236D346}
    3-Channel.ClientID:{56816B00-2BF0-470D-BA75-AA24F236D346}

On the Server:
==============
    TLoginService.TestAction$self.ClientID:{61683156-615B-41D1-8A7B-4C973A1DAE7D}  //this is the initial value of Message
    TLoginService.TestAction$self.ClientID:{56816B00-2BF0-470D-BA75-AA24F236D346}  //this is the initial value of Channel

(EvgenyK) #2

what channel type you are using? super or plain ?


(Matjeschk, Peter) #3

I’m using TROSuperTCPChannel


(RemObjects) #4

Thanks, logged as bugs://79946


(EvgenyK) #5

as a temporary workaround, pls reset ClientID on channel like ROChannel.ClientID :=EmptyGUID;


(Matjeschk, Peter) #6

Hi Evgeny,

sadly resetting teh ClientID to an empty GUID does not work, however when I assign the Message.ClientID to the Channel.ClientID, eveything works like expected:

procedure TClientDataModule.DataModuleCreate(Sender: TObject);
begin
  inherited;
  FHwnd := AllocateHWnd(WndMethod);
  Channel.Active := true;
  //Channel.ClientId := TGUID.Empty; //does not work, https://talk.remobjects.com/t/clientid-on-server-is-different-when-1st-call-is-async/16131
  //Message.ClientId := TGUID.Empty;  //does not work
  Channel.ClientId := Message.ClientID;  //this works
end;