1

we're having a strange issue with our Azure virtual machines. When we make a connection to the servers, via socket, then leave it idle for exactly 5 minutes, the connections gets dropped. It does not matter in which country the server is booted up, we get the same thing. Is there an automatic idle connection drop on azure?

We have tested this on servers hosted with other providers and the idle connection stays alive as long as we need it.

Hope someone knows how to resolve this?

Thanks.

RynoYssel
  • 11
  • 1
  • 2

2 Answers2

0

You can configure the client to send null packets and keep the connection alive:

If you are connecting from a unix machine (I haven't been able to test this part):

  1. Modify /etc/ssh/sshd_config
    • ClientAliveInterval 240
    • ClientAliveCountMax 2

If you are connecting from a windows machine you could use putty to do this by:

  1. Start PuTTY.
  2. Load your connection session
  3. Go to Category > Connection
  4. Under Sending of null packets to keep session active, in the Seconds between keepalives, 240
Spydernaz
  • 101
  • 1
  • Hi, Thank you for your response. Unfortunately this is not the issue, no matter which type of connection we use, like MySQL DB connection, or a socket to our API server, as soon as the connection becomes idle for 5 minutes, the connection gets dropped by the azure server. The exact same settings works fine with a different hosting provider. So it cannot be the settings. – RynoYssel Sep 05 '19 at 10:10
  • The above config settings are to stop the idle timeout as the null packet makes it look as if there is an active users still on the connections. If the other servers are not kicking the session it is most likely that they have the idle timeout configured differently. If this doesn't work then sorry :/ – Spydernaz Sep 08 '19 at 15:34
  • Hi @Spydernaz, thanks for the information, we appreciate it. We actually found the issue with Azure and they disconnect any idle connection after 4 min (changable to 30 minutes) but they do not end the connection "gracefully" by sending a TCP RST. We had to buy a "standard" loadbalancer from Azure to end the conn with a TCP RST packet, letting our app know that the connection has ended. The free loadbalancer that comes with the server, does not have this feature, hence it gives us this issue :-( PS. We are programming in Lazarus IDE and using Indy 10 to connect to the server via TCP – RynoYssel Sep 09 '19 at 06:30
  • PS. Found the solution on this post - https://serverfault.com/questions/661704/azure-closing-idle-network-connections – RynoYssel Sep 09 '19 at 06:33
  • Ooft, Thanks for sharing the answer above! appreciate it – Spydernaz Sep 09 '19 at 07:10
0

@Spydernaz has the solution, you simply need to send some keep alive packets. Thankfully I've only had to implement one horrible legacy application in Azure that relies on an open TCP socket. Spent a loooong time with MS Ent Support on this. You need the keep alive packets which is the most simple of configurations and is normally part of any open socket reliant system

Bevan
  • 151
  • 4
  • Hi @Bevan, we are using Lazarus IDE with Indy 10 to connect to the API server via TCP. We are unable to find the "keep alive" setting in it and will have to deal with it in a different way. Thank you for your response. we appreciate it. – RynoYssel Sep 09 '19 at 06:32
  • PS. Found the solution on this post - https://serverfault.com/questions/661704/azure-closing-idle-network-connections – RynoYssel Sep 09 '19 at 06:33