ITADN

Close() throws exception from the destructor of ProducerClient causing the users to terminate, without an opportunity to catch the exception

#6957OpenDeepa-Pathak 创建于 2026-02-16
questionClientcustomer-reportedService AttentionEvent Hubs
D
Deepa-Pathakcommented
In here a call to Close() is made from the destructors, destructors which are noexcept(true) by default. https://github.com/Azure/azure-sdk-for-cpp/blob/04f2ce086af80d41892bfffd645c891b36c98961/sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/producer_client.hpp#L101 Close() throws exceptions in various scenarios which leads to user getting terminated whenever that happens. From here I see two options: 1. Users can hardly do anything if for some reasons it could not be closed, so we can catch and log the exception. 2. Let users call Close themselves to properly handle the scenarios they want.
5 条评论