Skip to content
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

Potential typo in SimpleMessageListenerContainer when logging exceptions? #1062

Closed
Asapin opened this issue Aug 9, 2019 · 1 comment · Fixed by #1063
Closed

Potential typo in SimpleMessageListenerContainer when logging exceptions? #1062

Asapin opened this issue Aug 9, 2019 · 1 comment · Fixed by #1063

Comments

@Asapin
Copy link

Asapin commented Aug 9, 2019

Hello.
We recently experienced RabbitMQ outage and got the following logs from our RabbitMQ listener:

ERROR 6 --- [ntContainer#3-5] o.s.a.r.l.SimpleMessageListenerContainer : Consumer received fatal=false exception on startup

org.springframework.amqp.rabbit.listener.QueuesNotAvailableException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.

ERROR 6 --- [ntContainer#3-5] o.s.a.r.l.SimpleMessageListenerContainer : Stopping container from aborted consumer

And while investigating issues with our RabbitMQ configuration, we got really confused why container was stopped if it says fatal=false. Further investigation lead us to this code in org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer:

catch (QueuesNotAvailableException ex) {
    logger.error("Consumer received fatal=" + isMismatchedQueuesFatal() + " exception on startup", ex);
    if (isMissingQueuesFatal()) {
        this.startupException = ex;
        // Fatal, but no point re-throwing, so just abort.
        aborted = true;
    }
    publishConsumerFailedEvent("Consumer queue(s) not available", aborted, ex);
}

For logging this code checks isMismatchedQueuesFatal() method, but for actual logic it uses isMissingQueuesFatal().

Searching for other usages of isMismatchedQueuesFatal() shows that it's mainly used when configuring listener and declaring queues. The only other place where its usage is not configuration-related is the snippet above.

Is this intentional or just a typo?

@garyrussell
Copy link
Contributor

Yes; it's a typo; thanks for reporting - but it's also wrong to just log the value; the error should explicitly refer to the missingQueuesFatal property.

garyrussell added a commit to garyrussell/spring-amqp that referenced this issue Aug 9, 2019
artembilan pushed a commit that referenced this issue Aug 15, 2019
Fixes #1062

**cherry-pick to 2.1.x, 2.0.x**
artembilan pushed a commit that referenced this issue Aug 15, 2019
Fixes #1062

**cherry-pick to 2.1.x, 2.0.x**
artembilan pushed a commit that referenced this issue Aug 15, 2019
Fixes #1062

**cherry-pick to 2.1.x, 2.0.x**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants