[
https://issues.apache.org/jira/browse/SLING-3220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marc Pfaff updated SLING-3220:
------------------------------
Attachment: SLING-3220.patch
I managed to fix the endless loop, simply by ensuring all types of events are
handled and the event is reset to null accordingly. This ensures the loop
always takes the next event from the queue, which properly blocks the thread,
if the queue is empty.
The intention to put a 'stopped event' (Utility.TOPIC_STOPPED) on the queue to
control the background thread is unclear to me. Starting the thread is guarded
by the threadStarted flag, which ensures the thread is only started once. So
IMHO the thread must only be stopped on component deactivation.
Does this help?
> TimedEventSender put into a busy endless loop, after topology changes
> ---------------------------------------------------------------------
>
> Key: SLING-3220
> URL: https://issues.apache.org/jira/browse/SLING-3220
> Project: Sling
> Issue Type: Bug
> Components: Extensions
> Affects Versions: Event 3.3.0
> Reporter: Marc Pfaff
> Attachments: SLING-3220.patch
>
>
> There seem's to be an issue in the TimedEventSender that puts the related
> background thread into a busy endless loop. This has two effects:
> * Heavy CPU usage
> * Timed Jobs are never finished, if in the busy loop
> That's what I found out when debugging so far:
> * TimedEventSender starts a background thread that takes events from a
> blocking queue
> * If the event's topic is org/apache/sling/event/impl/jobs/STOPPED, the event
> is never processed and there is no new event taken from the queue, thus it's
> not properly waiting, but instead falls into the endless loop, as the event
> instance is never set to null
> * Events with the 'stop topic' are sent upon topology change event, handled
> by TimedEventSender itself, thus this only happens as soon as a new instance
> is joining the topology.
> In order to reproduce:
> * one must have a second instance joining the same topology
> I will try to come up with a patch.
--
This message was sent by Atlassian JIRA
(v6.1#6144)