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

EPH HostContext calling client.close() in a fire-and-forget way #1407

Closed
jeremymeng opened this issue Mar 2, 2019 · 1 comment
Closed

EPH HostContext calling client.close() in a fire-and-forget way #1407

jeremymeng opened this issue Mar 2, 2019 · 1 comment
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs

Comments

@jeremymeng
Copy link
Member

continuing the discussion at #1390 (comment)

There are three places

in HostContext where a client is created to retrieve hub information. The client is then closed in a fire-and-forget way, with any errors ignored

client.close.catch(/* do nothing */)

We would like to understand

  • Is there any reason for the current behavior (fire-and-forget) while ignoring errors?
  • If we are going to change to wait with await client.close(), do we need to catch errors in order to keep the behavior of swallowing all errors from client.close()?
  • Is it possible to for the client have proper clean-up in the close() method in the exceptional cases?

async close(): Promise<void> {
try {
if (this._context.connection.isOpen()) {
// Close all the senders.
for (const senderName of Object.keys(this._context.senders)) {
await this._context.senders[senderName].close();
}
// Close all the receivers.
for (const receiverName of Object.keys(this._context.receivers)) {
await this._context.receivers[receiverName].close();
}
// Close the cbs session;
await this._context.cbsSession.close();
// Close the management session
await this._context.managementSession!.close();
await this._context.connection.close();
this._context.wasConnectionCloseCalled = true;
log.client("Closed the amqp connection '%s' on the client.", this._context.connectionId);
}
} catch (err) {
const msg = `An error occurred while closing the connection "${this._context.connectionId}": ${JSON.stringify(err)}`;
log.error(msg);
throw new Error(msg);
}
}

@jeremymeng jeremymeng added Client This issue points to a problem in the data-plane of the library. Event Hubs labels Mar 2, 2019
@ramya-rao-a ramya-rao-a removed their assignment May 6, 2019
@ramya-rao-a ramya-rao-a added this to the [2020] February milestone Dec 5, 2019
@ramya-rao-a
Copy link
Contributor

The latest update to the @azure/event-hubs library replaces the need for the @azure/event-processor-host library which is now in maintenance state.

azure-sdk pushed a commit that referenced this issue Feb 12, 2021
Resolves #1388
Resolves #1407

Also ignores cached service principal if it no longer exists. I ran into this while testing since I cleaned up old SPs.
azure-sdk pushed a commit that referenced this issue Feb 13, 2021
Resolves #1388
Resolves #1407

Also ignores cached service principal if it no longer exists. I ran into this while testing since I cleaned up old SPs.
azure-sdk added a commit that referenced this issue Feb 13, 2021
* Improve TestResources docs and logging

Resolves #1388
Resolves #1407

Also ignores cached service principal if it no longer exists. I ran into this while testing since I cleaned up old SPs.

* Add ADP test sub to look-up

Co-authored-by: Heath Stewart <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs
Projects
None yet
Development

No branches or pull requests

2 participants