Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAI_AGAIN causes 'undefined' error on Ubuntu 18.04 #52

Open
shabbyrobe opened this issue Mar 2, 2020 · 1 comment
Open

EAI_AGAIN causes 'undefined' error on Ubuntu 18.04 #52

shabbyrobe opened this issue Mar 2, 2020 · 1 comment

Comments

@shabbyrobe
Copy link

shabbyrobe commented Mar 2, 2020

Describe the bug

When consuming events from an Azure EventHub and testing resilience to network connectivity
losses, I see the rhea-promise library failing with an 'undefined' error.

I realise this is an EventHub related example, but I would not expect to be seeing an error
of this nature from a lower-level library surfacing in my code.

A minimal example of the code I'm using (with specific properties redacted):

const { EventHubClient, EventHubConsumerClient, latestEventPosition } = require("@azure/event-hubs");

const consumerGroup = "...";
const connectionString = "...";
const eventHubName = "...";
const consumerClient = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName);

const subscription = consumerClient.subscribe(
  {
    processEvents: async (events, context) => {
      for (const event of events) {
        console.log(`part: '${context.partitionId}' recv: '${event.body}' prop: '${JSON.stringify(event.properties)}'`);
      }
    },
    processError: async (err, context) => console.log(`Error : ${err}`) },
  },
  { startPosition: latestEventPosition },
);

I start this script, then introduce network issues, and see the following error:

Error : MessagingError: getaddrinfo EAI_AGAIN xxxxxx.servicebus.windows.net
my-proj/node_modules/@azure/core-amqp/node_modules/rhea-promise/dist/lib/link.js:62
    return this.source.address;
                       ^

TypeError: Cannot read property 'address' of undefined
at Receiver.get address [as address] (my-proj/node_modules/@azure/core-amqp/node_modules/rhea-promise/dist/lib/link.js:62:28)
at Timeout.actionAfterTimeout [as _onTimeout] (my-proj/node_modules/@azure/core-amqp/dist/index.js:1182:47)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)

Expected behavior

I expect EAI_AGAIN to result in the library trying again, not erroring out.

Package-version: 1.0.0
node.js version: 12.16.1
OS name and version: Ubuntu 18.04

@shabbyrobe shabbyrobe changed the title EAI_AGAIN causes undefined EAI_AGAIN causes 'undefined' error on Ubuntu 18.04 Mar 2, 2020
@chradek
Copy link
Collaborator

chradek commented Jun 9, 2020

@shabbyrobe
Since you're using @azure/event-hubs, I wanted to mention that on the Azure SDK side we recently discovered a reason for why TypeError can be thrown from rhea-promise:
Azure/azure-sdk-for-js#8584

This comment in particular explains the steps that would need to happen to see this issue. We were able to fix this in version 5.2.1 of @azure/event-hubs for sending and receiving messages.

I wasn't able to reproduce this issue using just rhea-promise unless I called open on the connection while it was already open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants