[
https://issues.apache.org/jira/browse/CAMEL-11628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239002#comment-16239002
]
ASF GitHub Bot commented on CAMEL-11628:
----------------------------------------
bapowell closed pull request #2077: CAMEL-11628: camel-mqtt - Fix in
MQTTEndpoint for connection loop bug.
URL: https://github.com/apache/camel/pull/2077
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
index d0797782997..c9b38701041 100644
---
a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
+++
b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTEndpoint.java
@@ -230,6 +230,12 @@ protected void doStart() throws Exception {
}
protected void createConnection() {
+ if (connection != null) {
+ // In connect(), in the connection.connect() callback, onFailure()
doesn't seem to ever be called, so forcing the disconnect here.
+ // Without this, the fusesource MQTT client seems to be holding
the old connection object, and connection contention can ensue.
+ connection.disconnect(null);
+ }
+
connection = configuration.callbackConnection();
connection.listener(new Listener() {
@@ -328,7 +334,7 @@ public void onFailure(Throwable value) {
}
- public void onFailure(Throwable value) {
+ public void onFailure(Throwable value) { // this doesn't appear
to ever be called
LOG.warn("Failed to connect to " + configuration.getHost() + "
due " + value.getMessage());
promise.onFailure(value);
connection.disconnect(null);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> MQTT Connection loop
> --------------------
>
> Key: CAMEL-11628
> URL: https://issues.apache.org/jira/browse/CAMEL-11628
> Project: Camel
> Issue Type: Bug
> Components: camel-mqtt
> Affects Versions: 2.17.0
> Reporter: Fabrizio Spataro
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 2.19.5, 2.20.1, 2.21.0
>
>
> Hello everyone, i found an particular bug situation
> I have same mqtt producer with high volume traffic. When my application losts
> tcp connection to mqtt server i have follow connection loop error. This bug
> is sometime verified because it depend by multiple factors (load machine,
> load mqtt server, payload, etc)
> I am reading source code and i suppose that the bug is introduced by volatile
> variable connected (it isn't thread-safe)
> To resolve this bug you must refactoring all MQTTEndpoint connection code.
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
> [ hawtdispatch-DEFAULT-3] MQTTEndpoint INFO MQTT
> Connection connected to tcp://mqtt:1883
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)