-
Notifications
You must be signed in to change notification settings - Fork 58
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
Message Transfer with credit>1 will cause dead lock #117
Comments
Is the call to |
I tried to create a repro based on the provided information but couldn't. Could you please provide more detail, and/or a code sample? |
thank you for reply. the Pseudo code should like this: // .... _ = sender.Send(ctx, msg) // .... |
Thanks for the info. I'm still unable to repro this using v0.17.0. In your pseudo-code, are all the operations running on the same goroutine? What are the options you're using to create the sender and receiver? Also, what version are you using? |
I used v0.13, and I updated to v0.17.0 after this bug, also rewrite some code (some api changed), but the bug still there. opts = append(opts, amqp.LinkTargetAddress(queue)) senders[queue], err = mq.session.NewSender(opts...)` |
Here's my repro code. Does any of this look similar to what you're doing? Also, what peer are you connecting to, is it Azure service bus, or something else? func main() {
// prime with messages
client, err := amqp.Dial("amqp://localhost:25672")
if err != nil {
panic(err)
}
session, err := client.NewSession()
if err != nil {
panic(err)
}
sender, err := session.NewSender(
amqp.LinkTargetAddress("helloworld"))
if err != nil {
panic(err)
}
for i := 0; i < 100; i++ {
msg := amqp.NewMessage([]byte(fmt.Sprintf("test %d", i)))
if err = sender.Send(context.Background(), msg); err != nil {
panic(err)
}
}
// receive one message
recv, err := session.NewReceiver(
amqp.LinkSourceAddress("helloworld"),
amqp.LinkCredit(1))
if err != nil {
panic(err)
}
msg, err := recv.Receive(context.Background())
if err != nil {
panic(err)
}
// try to create new sender
_, err = session.NewSender(
amqp.LinkTargetAddress("helloworld"))
if err != nil {
panic(err)
}
fmt.Println(string(msg.GetData()))
recv.AcceptMessage(context.Background(), msg)
} |
almost the same except the begining, the message producer is another program, so i prefer to have a different session to first create receiver then sender. and I use activeMQ5 locally. |
I installed ActiveMQ 5.16.3 but still can't repro. I didn't change any config options for ActiveMQ though. Do you use a different configuration? |
Please try this, it will only print 2 message on console
|
Thanks this repros for me. My repro wasn't attempting to send a message on the new sender. I'm investigating. |
The issue is with link credit management. In this case, no receiver settlement mode has been specified, so we don't pause receiving transfer frames when the link credit is exhausted. One thing that stands out, if you require to explicitly settle your received messages (I assume you do since you call |
sorry for long delay, when I tried
some error got: |
Fixing in pending release |
i init receiver with session.NewReceiver using amqp.LinkCredit(10), and send message to another queue when received.
the send method will check if sender exist, if not, new a sender with session.NewSender......
that was bad, I cant get the sender for a long while and the message cannot be consumed....
so now, i have to make receiver using option amqp.LinkCredit(1) to resolve
The text was updated successfully, but these errors were encountered: