Roserver superTcp doesn t work after timeout. Bug?

bug
delphi
(Alessandro) #1

Hi!

I have client/Server Application with RoSuper tcp server. Each 0.5 seconds i need to send many datas to client. I have very slow bandwidth from server to client so sometimes server go to in timeout. After Server go in Timeout RoEventRepository doesn t works anymore. Roclient is connected with server but Server doesn t send any data to Client. Server doesn t notify to client that had a problem and i don t know what happen.

I do a small testcase so you can test it.

You need test application in 2 different pc or u need 2 Delphi applications opened.

From one Pc Server Side
Second Pc Client Side

Start Client and Server in Debug mode

Start Server side

Start Client Side and Login

After Login click Button1 in server side. Send Message each 1 second

In Client Insert a breakpoint (I have do BreakPoint button) and wait until Server go in timeout

After Server go in Timeout Press F9 in client so restart after Breakpoint.

Press F9 until Timeout exceptions end

When Server and client run , Client is connected to Server but server doesn t send message anymore.

So how can i fix it?

Br,Alessandro

testcase.rar (4.6 MB)

0 Likes

(Alessandro) #2

Ops Sorry RemObject Sdk Version 9.5.111.1399 and Delphi Rio

0 Likes

(EvgenyK) #3

Hi,

try to use code like

procedure TSuperTCPChannelChat_ServerMainForm.ROServerClientConnected(
  aChannel: IROTransport; const aGuid: TGUID);
begin
  if ROSessionManager.IsSessionPresent(aGuid) then
    ROEventRepository.AddSession(aGuid,aChannel as IROActiveEventServer,EID_ChatEvents);
end;

we have logged issue (#81334) for resubscribing to active events channels automatically after reconnecting in .NET compatible events mode

0 Likes

(Alessandro) #4

I have tested your code in testcase but doesn t works. There Is no solution? I do a big app (2 months) and now i must trash It.

0 Likes

(Alessandro) #5

Hi!
When It happen It Is possible disconnect client until It Will fixed? So my client reconnect and transfer data.
How Can i do?

0 Likes

(Alessandro) #6

Nobody answer me?

0 Likes

(EvgenyK) #7

I’m investigating this case.
as a temporary workaround, you can replace SuperTCP channels with any others.

0 Likes

(Alessandro) #8

So i can t use SuperTcp channel for my project? I must to use http channel? i will use Super http channel? i have read that also Synapse tcp channels have same problems……. Will works with Indy super http channel?

Br,Alessandro

0 Likes

(EvgenyK) #9

in this specific case (i.e. very slow bandwidth), plain http channel will work more stable in comparing with SuperTCP channel.
try to test your projects with plain http channel

0 Likes

(EvgenyK) #10

You can use this workaround:
add a new service method like

function TLoginService.IsReconnectNeeded: Boolean;
var
  i: integer;
  me:TROInMemoryEventRepository;
begin
  Result := True;
  if IsSessionPresent then begin
    me := TROInMemoryEventRepository(EventRepository);
    for i := 0 to me.SessionReferenceCount-1 do
      if me.SessionReferences[i].SessionID = ClientID then
        if me.SessionReferences[i].ActiveEventReference <> nil then begin
          result := False;
          break;
        end;
  end;
end;

and call it by timer, say, every 5-10 sec
if method returns True, you have to reconnect to server.

Note: it will work only if TROInMemoryEventRepository is used, as in this testcase.

0 Likes

(Alessandro) #11

Hi,

Thank you for reply. I have an other workaround. If client doesn t riceive data for n seconds i disconnect it

0 Likes

(Alessandro) #12

Hi!

I have solved problem check if data is sent or not.
Now i have an other big problem. If i connect 4 pc at same server and 1 pc go in timeout also other pcs go in timeout also if i don t have connection problem

0 Likes

(EvgenyK) #13

Hi,

what is happened after client’s timeout? other clients can’t receive events anymore?

0 Likes

(Alessandro) #14

So it seem that RoEventRepository use same connection channel so if client have problem all clients have same problem. So is possible to use RoEventRepository with different channels? how?

0 Likes

(EvgenyK) #15

Hi,

All your clients have the same client ID ???


try to update uROBaseSuperTCPServer.pas as

procedure TSendEvent.Callback(Caller: TROThreadPool; Thread: TThread);
..
          if fOwner.fEventRepository <> nil then begin
//            if Supports(fOwner.fEventRepository, IROSessionsChangesListener, aref) then
//              aref.SessionsChangedNotification(fClientGuid, saRemoveActiveListener, obj);

this should resolve original issue when client should perform reconnect for receiving events

known issue: server will resend events for which client didn’t confirm delivery so client side may receive some duplicated events.

0 Likes

(Alessandro) #16

No different Client id but when 1 pc have timeout problem other pc disconnect

0 Likes

(EvgenyK) #17

apply above patch and retest this issue

0 Likes

(Alessandro) #18

Thank you it seem that works but i same problem when for example i remove lan cable in 1 pc. Other pcs (with cable connected and different ip) disconnect it

0 Likes

(EvgenyK) #19

this code from another my reply should solve this case if your clients have enabled AutoReconnect property.

0 Likes

(Alessandro) #20

Problem Is not autoreconnect because It Do It manually but problem Is.
For example
I got a working client in usa,France and Italy (with differenti id)

If i unplug cable in France
Automatically disconnect client in usa and in Italy.
How i have said before It seem that use only 1 Channel. If i got an error all clients disconnect

0 Likes