-
Notifications
You must be signed in to change notification settings - Fork 626
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
Read timed out / TIMEOUT WAITING FOR ACK when sending/receiving messages in parallel #2896
Comments
Please, share a simple project with us to reproduce on our side. I just created one like this: @SpringBootApplication
public class SpringAmqpIssue2896Application {
private static final String MESSAGE = Stream
.generate(() -> "A")
.limit(1024 * 1024)
.collect(Collectors.joining());
public static void main(String[] args) {
ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringAmqpIssue2896Application.class);
final RabbitTemplate rabbitTemplate = applicationContext.getBean(RabbitTemplate.class);
final ExecutorService executorService = Executors.newFixedThreadPool(2);
for (int i = 0; i < 1000; i++) {
final String messageId = "id-" + i;
executorService.submit(() -> sendMessage(rabbitTemplate, messageId));
}
}
private static void sendMessage(final RabbitTemplate rabbitTemplate, final String messageId) {
try {
final CorrelationData correlationData = new CorrelationData();
rabbitTemplate.convertAndSend("", "someQueue", MESSAGE, correlationData);
System.out.println("Message " + messageId + " has been sent.");
final CorrelationData.Confirm confirm = correlationData.getFuture().get(10, TimeUnit.SECONDS);
System.out.println("Confirm Ack was " + confirm.isAck());
}
catch (Exception ex) {
throw new RuntimeException("An exception occurred.", ex);
}
}
@Bean
Queue someQueue() {
return new Queue("someQueue");
}
} And looks like result is totally OK:
|
Hi @artembilan, Sure. Here you go: https://github.com/nils-christian/spring-amqp-issue-2896 The relevant method can be found in TestDemoApplication.java. Best regards, Nils |
Thanks.
And that is expected because there is no queue bound to that When add some queue and bind it into your exchange:
I got same result as before with my own test:
I'm not sure how to reproduce your Anything else you can share to elaborate the problem? |
Interesting. The timeout happens on my system each time I execute the code without the queues. I will try and reproduce the example with binding and queries. In the meantime: Do you have any (other) idea what might trigger a "TIMEOUT WAITING FOR ACK"? This occurs in our environment again and again, but cleans up itself after some time. |
Duplication of #2907. Thank you and let's follow up in the issue from now on! |
Hi,
In what version(s) of Spring AMQP are you seeing this issue?
3.1.7
Describe the bug
We noticed that our application sometimes fails to send messages with "TIMEOUT WAITING FOR ACK". We were able to create a minimal example which fails to send messages once we send them in parallel.
To Reproduce
Please take a look at the following example:
The configuration is
The example sends 1000 messages - each containing approx. 1 MiByte payload - with two threads. After some messages it fails with
If we add a synchronized block around sendMessage, everything works.
Expected behavior
The messages are send without issues regarding the ack.
Thank you and best regards,
Nils
The text was updated successfully, but these errors were encountered: