You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Björn Abramson (JIRA)" <ji...@apache.org> on 2016/08/29 12:26:20 UTC
[jira] [Commented] (AMQ-796) Client may shtudown when failover
connection is reconnecting. We need to maintain at least 1 non-daemon
thread alive.
[ https://issues.apache.org/jira/browse/AMQ-796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15445717#comment-15445717 ]
Björn Abramson commented on AMQ-796:
------------------------------------
This issue still seem to exists with client version 5.14.0 using a MessageListener and single threaded application. The reconnect tasks are still daemon threads.
Cause:
When the FailoverTransport is created the associated task runner will have daemon = true set. Code path:
FailoverTransport.java:
136 reconnectTaskFactory = new TaskRunnerFactory();
137 reconnectTaskFactory.init();
TaskRunnerFactory.java:
58 public TaskRunnerFactory() {
59 this("ActiveMQ Task");
60 }
61
62 public TaskRunnerFactory(String name) {
63 this(name, Thread.NORM_PRIORITY, true, 1000);
64 }
The third parameter (daemon = true) is the culpit.
It seems that the simplest solution is what has been suggested previously, explicitly setting daemon = false on the reconnect factory:
reconnectTaskFactory.setDaemon(false);
> Client may shtudown when failover connection is reconnecting. We need to maintain at least 1 non-daemon thread alive.
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: AMQ-796
> URL: https://issues.apache.org/jira/browse/AMQ-796
> Project: ActiveMQ
> Issue Type: Bug
> Affects Versions: 4.0, 5.3.0
> Reporter: Hiram Chirino
> Assignee: Rob Davies
> Fix For: 5.6.0, 4.0.3
>
> Attachments: AMQ-796.cmd, jstack_amq_5.6.0, jstack_v5.8.0
>
>
> Dejan Reported on the User lists:
> Hi,
> after some experiments I found that this problem only exists if there are no
> other threads in the application. It seems like connection thread dies
> before it manages to reconnect. By starting another thread in the
> application, it succeeds to recover from master failure and reconnect to the
> slave broker. So I have a workaround for now, but it would be nice to make
> this work even for simple (single-threaded) clients.
> Regards,
> Dejan
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)