You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2019/06/09 11:45:00 UTC
[jira] [Resolved] (CAMEL-13625) Quartz2 firenow doesn't work
consistently
[ https://issues.apache.org/jira/browse/CAMEL-13625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-13625.
---------------------------------
Resolution: Fixed
Fix Version/s: 3.0.0.M4
2.25.0
2.24.1
2.23.3
3.0.0
Thanks for reporting and the analysis of the bug
> Quartz2 firenow doesn't work consistently
> -----------------------------------------
>
> Key: CAMEL-13625
> URL: https://issues.apache.org/jira/browse/CAMEL-13625
> Project: Camel
> Issue Type: Bug
> Components: camel-quartz2
> Affects Versions: 2.24.0
> Reporter: Deepak
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 3.0.0, 2.23.3, 2.24.1, 2.25.0, 3.0.0.M4
>
> Attachments: Solution.java, cameltest.zip
>
>
> Hi Colleagues,
> We have an interesting bug in the camel-quartz2 where the firenow doesn't work consistently.
> it works sometimes and sometimes it doesn't. On debug i found that the problem occurs when Scheduler starts it invokes *CamleJob,* *CamleJob* starts executing and tries to read from *getProcessors()* method of *LoadBalancerSupport* class. sometimes *getProcessors()* method returns empty list as a result routes doesn't get executed.
> *StartupListener* (QuartzComponent) gets notified much before the *QuartzConsumer* starts, as a result it is not able to get the List<Processor> from *getProcessors()* method of *LoadBalancerSupport* class.
>
> Analysis of the problem
> --------------------------------------------------------------------------------------------------
> # *DefaultCamelContext* method *safelyStartRouteServices()* notifies QuartzComponent's *onCamelContextStarted()* method.
> # The above step starts the scheduler which then calls *execute()* method in *CamelJob* class.
> # In the execute() method it invokes *getProcessors()* method of *LoadBalancerSupport* class to get the List<Processor>.
> # Sometimes *getProcessors()* returns empty list.
> # The reason is List<Processor> in *LoadBalancerSupport* class is populated by *QuartzConsumer* on start of consumer. but it is started after QuartzComponent's *onCamelContextStarted()* method is called in *DefaultCamelContext*.
> # When i checked the older version of camel which we are using in our organization 2.17.0 i see the order is different.
> # Consumer starts first then the classes that implements *StartupListener*.
> To Summarize
> -------------------------------------------------------------------------------------------------------
> # The order in which *StartupListener* and *Consumer* is started in *DefaultCamelContext* is causing race condition.
> # The older version of camel 2.17.0 order is first *Consumer* starts followed by classes that implement *StartupListener*
>
> I have attached the junit with quartz2, since it is intermittent issue, i made the junit to run 1000 times and it fails randomly which proves existence of the problem.
> I have also attached by proposed solution in DefaultCamelContext in the attachment.
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)