How to prevent rare cases where RO HTTPS call hangs

On rare occasions we have a RO client (that uses a HTTPS connection) hangs in a call.

It gets stuck in Receive functions. See screenshot.

Is there a way to prevent this (apart from killing the thread and respawning it)?

What is your suggested approach?

Hi
The thread is stuck in the TLS handshake, not waiting for a reply…

As a workaround, add in a connection factory that sets the timeout before connecting.
The broken connection still can’t complete the call, but instead of hanging forever you get an exception after ConnectTimeout seconds catch it, drop the connection and retry.

public class TimeoutAwareSslFactory : HttpsConnectionFactory
{
    public TimeoutAwareSslFactory(HttpProxySettings proxy) : base(proxy) { }
    public int ConnectTimeout { get; set; } = 15;

    public override Connection CreateClientConnection(Binding binding)
    {
        var inner = new Connection(binding);
        inner.Timeout = this.ConnectTimeout;
        inner.TimeoutEnabled = true;
        if (!this.Enabled) return inner;

        var ssl = base.CreateClientConnection(inner);
        ssl.Timeout = this.ConnectTimeout;
        ssl.TimeoutEnabled = true;
        return ssl;
    }
}

Then set it on your channel right after you create it:

var factory = new TimeoutAwareSslFactory(channel.ProxySettings);
factory.CopyProperties(channel.SslOptions);
channel.HttpClient.SslOptions = factory;

We will fix this soon.

Logged as bugs://D19710.

bugs://D19710 was closed as fixed.

Fix will be in the next release

Is there a way of finding out as of which release this fix is in?

The link does not give me much info

We don’t have a specific date but we can upload current internal build with this fix so you can test it

I cannot trigger the issue, I just notice it occurs very infrequently.

If I read your comments correctly: I do not need to change/add any code myself? Just update to the latest SDK?

Yes, no code changes needed just update the SDK.

The timeout was always on by default (60 sec), it simply wasn’t applied during
connect and the TLS handshake.
Now it is, so the call throws instead of hanging.