Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Uncaught exception in Datasnap Callback-LoopThread (ConsumeClientChannel)



Permlink Replies: 2 - Last Post: Oct 21, 2017 9:40 AM Last Post By: Stéphane WIERZB...
Daniel Forstner

Posts: 2
Registered: 8/30/04
Uncaught exception in Datasnap Callback-LoopThread (ConsumeClientChannel)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 18, 2017 4:14 AM
Hello,

I have a problem with Datasnap callbacks on Android.

I use a TDSRestClientChannel for registering a callback at a ISAPI Datasnap REST server application. When running my client application in Windows, everything is working properly. When debugging, I can see periodically, that ConsumeClientChannel runs into a timeout, but this time-out exception is handled properly.

When running the same app at an Android device, it stops working when the first timeout appears. I localized the problem at the unit Datasnap.DSClientRest, procedure TCallbackLoopThread.Execute:

try
        // Must pass '' when using an existing channel
        // Block until the server responds
        try
          LJSONValue := LClient.ConsumeClientChannel(FChannelName, FClientManagerId, Emptystr, Emptystr, LStatusValue);
          try
            FWorker(LJSONValue, LStatus, LStopped);
          finally
            LJSONValue.Free;
          end;
        except
          on E: TDSRestProtocolException do
            // Ignore session expired
            LStopped := True;
          else
            raise;
        end;
      finally
        LStatusValue.Free;
      end;


In Windows, the exeception is caught properly by on E: TDSRestProtocolException do, while in Android the exception class seems to be unknown and the exception is raised, which results in an uncaught exception and my app terminates.

Is anyone suffering of similar problems? Why is the exception class unknown in Android?

Kind regards,
Daniel
Daniel Forstner

Posts: 2
Registered: 8/30/04
Re: Uncaught exception in Datasnap Callback-LoopThread (ConsumeClientChannel)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 19, 2017 4:26 AM   in response to: Daniel Forstner in response to: Daniel Forstner
OK, seems that I'm the only one with this kind of problems. I could solve this problem by patching the datasnap - restclient unit in order to behave the same for all kinds of exceptions.
That's not what I want to do, but at the moment my only workaround:

      try
        // Must pass '' when using an existing channel
        // Block until the server responds
        try
          LJSONValue := LClient.ConsumeClientChannel(FChannelName, FClientManagerId, Emptystr, Emptystr, LStatusValue);
          try
            FWorker(LJSONValue, LStatus, LStopped);
          finally
            LJSONValue.Free;
          end;
        except
            // Ignore session expired
            LStopped := True;
        end;
      finally
        LStatusValue.Free;
      end;


If anyone has a better solution for me, I'd be glad to know it.

Kind regards,
Daniel
Stéphane WIERZB...

Posts: 58
Registered: 9/3/00
Re: Uncaught exception in Datasnap Callback-LoopThread (ConsumeClientChannel)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 21, 2017 9:40 AM   in response to: Daniel Forstner in response to: Daniel Forstner
You should create a ticket for this !

Daniel Forstner wrote:
OK, seems that I'm the only one with this kind of problems. I could solve this problem by patching the datasnap - restclient unit in order to behave the same for all kinds of exceptions.
That's not what I want to do, but at the moment my only workaround:

      try
        // Must pass '' when using an existing channel
        // Block until the server responds
        try
          LJSONValue := LClient.ConsumeClientChannel(FChannelName, FClientManagerId, Emptystr, Emptystr, LStatusValue);
          try
            FWorker(LJSONValue, LStatus, LStopped);
          finally
            LJSONValue.Free;
          end;
        except
            // Ignore session expired
            LStopped := True;
        end;
      finally
        LStatusValue.Free;
      end;


If anyone has a better solution for me, I'd be glad to know it.

Kind regards,
Daniel
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02