Skip to content

ARTEMIS-6217 mitigate shutdown stacktraces for MQTT - #6653

Open
jbertram wants to merge 1 commit into
apache:mainfrom
jbertram:ARTEMIS-6217
Open

ARTEMIS-6217 mitigate shutdown stacktraces for MQTT#6653
jbertram wants to merge 1 commit into
apache:mainfrom
jbertram:ARTEMIS-6217

Conversation

@jbertram

Copy link
Copy Markdown
Contributor

When the broker is processing MQTT packets (especially those related to QoS 2 message flows) a shutdown can cause the broker to log several different stack-traces that are effectively harmless, but can alarm users. The broker should detect these and avoid logging them.

@@ -50,6 +57,8 @@ public int sendMessage(MessageReference ref,
int deliveryCount) {
try {
session.getMqttPublishManager().publishToClient(ref.getMessage().toCore(), consumer);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the right thing would be to make sure these are flushed before. the stop on the MQTPPProtocolManager flushing everything would be a better fix. (the stop is one place it could / should block until things are done).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm exploring this idea... 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into what you suggested here and I have a few thoughts:

  1. There is no stop (or equivalent) method for protocol managers. However, it's possible for the protocol manager to register an activation callback and leverage, e.g. org.apache.activemq.artemis.core.server.impl.CleaningActivateCallback#deActivate.
  2. In order to wait for MQTT tasks to finish I now have to track them. This means adding logic to the hot path for all MQTT packet handling rather than just dealing with these exceptions. It is arguably more "correct" to handle shutdown this way, but there is a cost, and I'm not sure that cost is worth paying.

I'd love your thoughts.

When the broker is processing MQTT packets (especially those related to
QoS 2 message flows) a shutdown can cause the broker to log spurious
messages, including several different stack-traces that are effectively
harmless, but can alarm users. The broker should detect these and avoid
logging them.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants