#1 2021-05-03 11:56:42

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

TSQLHttpClientWebsockets (too) long ConnectTimeout

Hi,  (Windows 10 pro 64bit, Sydney 10.4.2)


TSQLHttpClientWebsockets.Create(Host,Port,TSQLModel.Create([],ROOT_NAME),
                                            false,'','',
                                            SendTimeout,ReceiveTimeout,ConnectTimeout);
ConnectTimeout takes very long (over 40 seconds) in case of non existent IP / service, although we set it to 3000 miliseconds.


Thank you,
Vojko Cendak

Offline

#2 2021-05-04 07:01:11

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

Re: TSQLHttpClientWebsockets (too) long ConnectTimeout

The value should be propagated to SO_RCVTIMEO/SO_SNDTIMEO socket properties.

Could you use the debugger to find out why it is not the case on your place?

Offline

#3 2021-05-05 08:29:02

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

Re: TSQLHttpClientWebsockets (too) long ConnectTimeout

The properties are set through SetInt32Option

    // open client connection
    if ConnectTimeout>0 then begin
      SetInt32Option(result,SO_RCVTIMEO,ConnectTimeout);  <== ConnectTimeout = 3000
      SetInt32Option(result,SO_SNDTIMEO,ConnectTimeout);  <== ConnectTimeout = 3000
    end;
    if Connect(result,sin)<>0 then begin    <== waits around 20 - 30 secs
       CloseSocket(result);
       result := -1;
    end;

Offline

#4 2021-05-05 16:48:32

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

Re: TSQLHttpClientWebsockets (too) long ConnectTimeout

It sounds like if connection timeout is not set by regular receive/send timeout options.
It is set at the system level, sadly.

So we will now try to use non-blocking mode for Connect() then call Select/Poll.
I have just added it to mORMot 2.

Offline

#5 2021-05-05 19:05:41

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

Re: TSQLHttpClientWebsockets (too) long ConnectTimeout

Is it possible to add to mormot too ?
I'm not shure if we can migrate to mormot2 yet ...

Offline

#6 2021-05-05 19:49:54

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

Re: TSQLHttpClientWebsockets (too) long ConnectTimeout

For mORMot 1 it is not so easy to integrate sad

Offline

#7 2021-10-08 13:13:53

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

Re: TSQLHttpClientWebsockets (too) long ConnectTimeout

thank you,

is there any other way ?
because we have lots of situations where ridiculously long timeouts stuck the app,
not gui, but termination of threads, restart of threads, ... getting user to see what is happening.

I don't know how others deal with situations when network breaks (which is normal situation), then you retry until it reestablishes the connection.

thank you

Last edited by VojkoCendak (2021-10-08 13:17:11)

Offline

Board footer

Powered by FluxBB