-
Notifications
You must be signed in to change notification settings - Fork 796
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
Unable to cancel client.AcceptNextSessionForQueue(..) function #17565
Comments
I observe a hang waiting for an ack during link attachment. I'm wondering if this is due to no sessions being available (at least in my simple repro).
Eventually, service bus sends us a detach as the operation timed out. @richardpark-msft is |
Looking at the docs for the C# implementation, I believe this is the expected behavior. We will need to update |
Interesting, this would need to be up the entire chain: // connection
conn = amqp.New()
// session
sess = conn.NewSession()
// receiver
session.NewReceiver()
// and probably sender as well) In this particular case the "hanging" call is probably the worst offender. I don't think go-amqp itself is lazy, so adding cancellation into |
@orzel7, glad to see you again (although sorry it's because of a bug) I'll be taking a look at this. At a high level we'll probably have to handle this cancellation within azservicebus, rather than go-amqp (like @jhendrixMSFT and I initiallly discussed) mostly because there's some state to rollback and that's a bit easier in azservicebus at this time. I'll update with a PR soon. |
AcceptNextSessionFor(Queue|Subscription) can block for a long time (server dependent) if there are no available sessions. HOWEVER, it was intended to be cancellable, which wasn't working. This is a simpler workaround until we get context support plumbed through go-amqp itself. Fixes #17565
Hi @orzel7, a fix has been merged. Our official package releases are monthly so this isn't tagged, but you can retrieve it using the commit itself: go get github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus@63195b99ab9a611a0e5c9cb85a3a49390f4c6855 |
pkg: github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus
SDK version: v0.4.0
go version: go 1.18
What happened?
function client.AcceptNextSessionForQueue(ctx, queueName, options) is not cancellable by context, passed as first argument. For example, if I want to interrupt this function by signal or by timeout, I need to wait about 1 minute before function exits with error "context canceled".
The text was updated successfully, but these errors were encountered: