bug: Azure Service Bus session receivers fail in the Go SDK, attach response has a bare session filter value #86
ivan-penchev
started this conversation in
Bugs (Azure)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Current Behavior
Go clients can't accept a Service Bus session on LocalStack for Azure. Both
AcceptSessionForQueueandAcceptNextSessionForQueuefail with this error:The client sends the
com.microsoft:session-filterentry in the sourcefilter set of its attach frame. LocalStack echoes that filter back in its
attach response, but drops the described-type wrapper. The value comes back
as a plain
str8-utf8, which is byte0xa1, or asvbinforAcceptNextSession. The AMQP 1.0 spec, section 3.5.8, says filter-setvalues must be described types or null. go-amqp follows the spec strictly,
so it rejects the frame and the receiver never opens.
The Python SDK
azure-servicebusaccepts sessions against the samecontainer. I think it just doesn't decode that field strictly. Every Go
service that uses sessions is blocked.
To confirm the cause, I patched a local copy of go-amqp so
Filter.Unmarshalaccepts a value without the wrapper. About 10 lines.With that patch everything works: named session, next session, complete,
abandon, and dead-lettering with
MaxDeliveryCountExceeded. So the rest ofthe broker looks fine. Only the echoed filter is wrong.
Expected Behavior
The attach response should echo the session filter as a described type, the
same way Azure Service Bus does. Descriptor is
com.microsoft:session-filter, code0x00000137000000C, and the value isthe session ID string or null. Then the unpatched Go SDK accepts sessions.
How are you starting LocalStack?
With a
docker runcommandSteps To Reproduce
Start LocalStack for Azure:
docker run --rm -p 4566:4566 -p 4510-4559:4510-4559 \ -v /var/run/docker.sock:/var/run/docker.sock \ -e LOCALSTACK_AUTH_TOKEN=$LOCALSTACK_AUTH_TOKEN \ localstack/localstack-azure:latestThrough ARM, create a Service Bus namespace and a queue with
requiresSession: true. Get the connection string fromlistKeys.Run this with
azservicebusv1.11.0, which pulls ingo-amqpv1.7.0:Sending works. Accepting the session fails.
Environment
Anything else?
Second, smaller session bug. If a session is already locked, a second
AcceptSessionForQueueon it succeeds. The errorcom.microsoft:session-cannot-be-lockedonly comes on the first receive.Azure refuses the attach itself, so clients expect the error from
AcceptSession. Exclusivity does hold, it's just reported late. Happy tofile this one separately if you prefer.
This is the go-amqp workaround I used, in
internal/encoding,Filter.Unmarshal:All reactions