Getting Timeout from Azure Service Bus

Carlos Sosa 5 Reputation points
2025-10-02T16:52:12.3133333+00:00

I'm getting frequent TimeOut errors, from different locations a Twilio Function and an Azure Function.

These are long dumps from the Azure Function:

2025-10-02T16:40:43.398Z] Transport connection failed: TimeoutError('timed out')

[2025-10-02T16:40:43.401Z] AMQP error occurred: (AMQPConnectionError('Error condition: ErrorCondition.SocketError\n Error Description: Failed to initiate the connection due to exception: timed out')), condition: (<ErrorCondition.SocketError: b'amqp:socket-error'>), description: ('Failed to initiate the connection due to exception: timed out').

[2025-10-02T16:40:43.567Z] Link state changed: <LinkState.DETACHED: 0> -> <LinkState.ATTACH_SENT: 1>

[2025-10-02T16:40:44.998Z] 'servicebus.pysdk-508819a0' has an exception (ServiceBusConnectionError('Failed to initiate the connection due to exception: timed out Error condition: amqp:socket-error.')). Retrying.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
{count} vote

1 answer

Sort by: Most helpful
  1. Pashikanti Kumar 1,725 Reputation points Microsoft External Staff Moderator
    2025-10-02T19:11:45.0666667+00:00

    Hi Carlos Sosa,

    The timeout error log from your Twilio Function indicates this error

    ServiceBusError: ETIMEDOUT: connect ETIMEDOUT 20.62.63.31:5671

     

    This means the function was unable to establish a TCP connection to the Azure Service Bus IP address on port 5671 (the AMQP port) within the configured timeout.

     

    • Your Function App is running inside Azure network, which should typically have good outbound connectivity.
    • However, frequent connection timeouts (e.g., failing 3 out of 5 connections) usually indicate network reachability or firewall issues, or port blocking.
    • Port 5671 (AMQP) must be open outbound for the Azure Service Bus SDK to connect.
    • The error is a kernel-level TCP timeout (ETIMEDOUT) before establishing any SSL or AMQP communication.
    • This could be intermittent due to:
      • Network Security Groups (NSGs) or Azure Firewall rules restricting outbound TCP on port 5671 intermittently.

    Reference

    Service Bus, Event Hubs, and Web Sockets | Microsoft Community Hub

    Troubleshooting guide for Azure Service Bus - Azure Service Bus | Microsoft Learn

    ServiceBusClientOptions interface | Microsoft Learn

    Kindly let us know if the above helps or you need further assistance on this issue.

    Please "Upvote" if the information helped you. This will help us and others in the community as well.

    Thanks


Your answer

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