question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[azure-eventhub] Failure: sending socket failed. errno=104 (Connection reset by peer). [too many error logs]

See original GitHub issue
  • azure-eventhub==5.7.0, azure-identity=1.9.0:
  • Linux:
  • 3.9:

Describe the bug We are getting tons of errors like below frequently. Don’t see any issues with Eventhub publish functionality - but lots of logs like below are quite noisy and distracting. can you please help check what’s happening ?

engineapi | INFO [2022-07-27 07:00:50,104] connection.py:260 b’Failure: sending socket failed. errno=104 (Connection reset by peer).’ (b’/data/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/socketio_berkeley.c’:b’socketio_send’:944) engineapi | INFO [2022-07-27 07:00:50,104] connection.py:260 b’Error in xio_send.’ (b’/data/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/tlsio_openssl.c’:b’write_outgoing_bytes’:702) engineapi | INFO [2022-07-27 07:00:50,104] connection.py:260 b’Error in write_outgoing_bytes.’ (b’/data/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/tlsio_openssl.c’:b’tlsio_openssl_send’:1553) engineapi | INFO [2022-07-27 07:00:50,105] connection.py:260 b’Cannot send encoded bytes’ (b’/data/src/vendor/azure-uamqp-c/src/connection.c’:b’on_bytes_encoded’:268) engineapi | INFO [2022-07-27 07:00:50,105] connection.py:260 b’xio_send failed’ (b’/data/src/vendor/azure-uamqp-c/src/saslclientio.c’:b’saslclientio_send_async’:1190) engineapi | INFO [2022-07-27 07:00:50,106] connection.py:177 Connection b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’ state changed from <ConnectionState.OPENED: 9> to <ConnectionState.END: 13> engineapi | INFO [2022-07-27 07:00:50,106] connection.py:181 Connection with ID b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’ unexpectedly in an error state. Closing: False, Error: None engineapi | INFO [2022-07-27 07:00:50,106] connection.py:260 CBS error occurred on connection b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’. engineapi | INFO [2022-07-27 07:00:50,106] sender.py:268 Message sender b’sender-link-dbafd928-afe1-4904-9daa-052f85b379d5’ state changed from <MessageSenderState.Open: 3> to <MessageSenderState.Idle: 1> on connection: b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’ engineapi | WARNING [2022-07-27 07:00:50,106] connection.py:256 ConnectionClose(‘ErrorCodes.UnknownError: Connection in an unexpected error state.’) engineapi | INFO [2022-07-27 07:00:50,106] connection.py:129 Shutting down connection b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’. engineapi | INFO [2022-07-27 07:00:50,106] cbs_auth.py:86 Shutting down CBS session on connection: b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’. engineapi | INFO [2022-07-27 07:00:50,106] cbs_auth.py:90 Auth closed, destroying session on connection: b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’. engineapi | INFO [2022-07-27 07:00:50,106] cbs_auth.py:93 Finished shutting down CBS session on connection: b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’. engineapi | INFO [2022-07-27 07:00:50,107] connection.py:134 b’send called while not open’ (b’/data/src/vendor/azure-uamqp-c/src/saslclientio.c’:b’saslclientio_send_async’:1181) engineapi | INFO [2022-07-27 07:00:50,107] connection.py:134 b’saslclientio_close called while not open’ (b’/data/src/vendor/azure-uamqp-c/src/saslclientio.c’:b’saslclientio_close_async’:1130) engineapi | INFO [2022-07-27 07:00:50,107] connection.py:134 b’Cannot send encoded bytes’ (b’/data/src/vendor/azure-uamqp-c/src/connection.c’:b’on_bytes_encoded’:268) engineapi | INFO [2022-07-27 07:00:50,107] connection.py:134 b’xio_close failed’ (b’/data/src/vendor/azure-uamqp-c/src/connection.c’:b’on_bytes_encoded’:272) engineapi | INFO [2022-07-27 07:00:50,107] connection.py:177 Connection b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’ state changed from <ConnectionState.END: 13> to <ConnectionState.END: 13> engineapi | INFO [2022-07-27 07:00:50,107] connection.py:177 Connection b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’ state changed from <ConnectionState.END: 13> to <ConnectionState.END: 13> engineapi | INFO [2022-07-27 07:00:50,107] connection.py:134 b’saslclientio_close called while not open’ (b’/data/src/vendor/azure-uamqp-c/src/saslclientio.c’:b’saslclientio_close_async’:1130) engineapi | INFO [2022-07-27 07:00:50,107] connection.py:134 b’xio_close failed’ (b’/data/src/vendor/azure-uamqp-c/src/connection.c’:b’connection_close’:1437) engineapi | INFO [2022-07-27 07:00:50,107] connection.py:136 Connection shutdown complete b’EHProducer-c32fd323-38d3-4343-88be-4a2f69359181’.

Code I am using to send the events to eventhub:

class EventhubDataProducer(UsageDataSinkInterface):
    """ The EventhubDataProducer class implements the functionality of sending usage data to eventhub.
    """

    def __init__(
        self,
        config: AzureUsageConfig,
        max_size_in_bytes=AzureUsageLoggerConstants.USAGE_DATA_MAX_BATCH_SIZE_IN_BYTES
    ):
        self.max_size_in_bytes = max_size_in_bytes
        self.credential = ManagedIdentityCredential(
            client_id=config.USAGE_DATA_PRODUCER_IDENTITY)
        self.producer = EventHubProducerClient(
            fully_qualified_namespace=config.USAGE_EVENTHUB_NAMESPACE,
            eventhub_name=config.USAGE_EVENTHUB_NAME,
            credential=self.credential,
            # retry related parameters
            retry_total=3,
            retry_backoff_factor=0.2,
            retry_mode="exponential")
        self.defalt_tags = get_metric_default_tags()
        logger.info("Using eventhub as the sink for openai usage events")

    def send_usage_data_batch(self, event_data_batch: EventDataBatch, batched_events: list):
        try:
            self.producer.send_batch(event_data_batch)
        except:
            log_error(etype=ErrorType.EVENTHUB_DATA_SEND_ERROR,
                      tb=traceback.format_exc())

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
niteshmachacommented, Aug 2, 2022

Hi @swathipil - The workaround resolved our issue. Thanks

0reactions
msftbot[bot]commented, Aug 9, 2022

Hi, we’re sending this friendly reminder because we haven’t heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don’t hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python handling socket.error: [Errno 104] Connection reset by ...
"Connection reset by peer" is the TCP/IP equivalent of slamming the phone back on the hook. It's more polite than merely not replying, ......
Read more >
error error sending data: [errno 104] connection reset by peer
Azure/azure-sdk-for-python[azure-eventhub] Failure: sending socket failed. errno=104 (Connection reset by peer). [too many error logs]#25431.
Read more >
Publishing to Logstash fails with "connection reset by peer ...
Failed to publish events caused by: write tcp ... write: connection reset by peer. To solve the problem: make sure the firewall is...
Read more >
IO Error: send failed, errno = 104 And Connection Reset By ...
IO Error: send failed, errno = 104 And Connection Reset By Peer When Running Java Stored Procedure With ASO Encryption (Doc ID 2759060.1)....
Read more >
SharePoint restore failing with error 2804 - VOX - Veritas
Activity Monitor Error logs : 04/18/2016 10:43:57 - Error bpbrm (pid=16309) socket read failed: errno = 104 - Connection reset by peer
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found