TCP Connections dropped after approx 5 mins of inactivity

Mike Taylor 116 Reputation points
2020-11-05T10:30:16.17+00:00

I have the idle timeout set to 20 minutes. However, tests with a Python TCP client talking to a a Python TCP server using "epoll", give me an issue when the idle time is roughly 5 minutes of inactivity. I loose the last packet sent, and get an error thrown from the client when after 10 minutes it tries to close the connection, as follows:-

Traceback (most recent call last):
File "atlas_client.py", line 121, in <module>
make_connection()
File "atlas_client.py", line 111, in make_connection
skt.shutdown(socket.SHUT_RDWR)
OSError: [Errno 107] Transport endpoint is not connected

Running this test locally on my Ubuntu VM, gives no such issue.

I am a bit of a loss as to what to try. I can (I believe) force keep-alive packets, however on a 4g connection when we are paying for each and every byte sent/received I don't really want to do this.

How can I tell whether this is an Azure firewall issue, Ubuntu VM or a problem with my code?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,873 questions
Azure Firewall
Azure Firewall
An Azure network security service that is used to protect Azure Virtual Network resources.
662 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,427 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mike Taylor 116 Reputation points
    2020-11-16T19:17:57.58+00:00

    That's ok thank you, I have asked the question via Azure portal.


9 additional answers

Sort by: Most helpful
  1. Mike Taylor 116 Reputation points
    2020-11-08T17:30:59.903+00:00

    ![38221-screenshot-2020-11-08-172859.png][1]I am still confused as to why the "idle" timeout value on the Azure system can be set to 30 minutes, yet it still drops connections after 5 minutes.

    0 comments No comments

  2. SaiKishor-MSFT 17,231 Reputation points
    2020-11-09T22:12:35.993+00:00

    @Mike Taylor
    Thanks for providing the screenshot. I understand that you have configured the timeout value in the public IP address portal. Public IP address has an adjustable inbound originated flow idle timeout of 4-30 minutes, with a default of 4 minutes, and fixed outbound originated flow idle timeout of 4 minutes.

    So if this flow is outbound originated, you cannot adjust the idle timeout using the portal. The only other option is to use the keepalives option. Please let me know if you have any other questions. Thank you!

    0 comments No comments

  3. Mike Taylor 116 Reputation points
    2020-11-10T10:26:53.993+00:00

    @SaiKishor-MSFT

    The client (the device on the mobile network) makes a persistent TCP connection to the server running on Azure. I would of therefore expected this to follow the rule of "inbound originated", which is set to 30 minutes. What is actually happening, is that after ~4-5 minutes of inactivity , the connection is dropped, however "netstat" still shows it as being alive.

    When after 10 minutes, the client tries to send the next packet of data, it is being lost. Our mobile operator confirms there is no time-out on the SIM and this issue appears to of started since moving the server software to Azure.

    I can force it to keep the connection going by enabling keep-alives, however this means more traffic on the wire, which ultimately means more costs to us.

    Why, in this instance, would the fixed outbound flow idle period of 4 minutes, be taking precedence?


  4. Mike Taylor 116 Reputation points
    2020-11-11T13:08:57.367+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.