Uploaded image for project: 'JS - JobScheduler'
  1. JS - JobScheduler
  2. JS-1791

Plugin threads should use new EventPublisher to publish CustomEvent

    XMLWordPrintable

Details

    Description

      Current Situation

      Plugins inject an Eventbus to publish events which is not thread-safe.
      In very rare cases two threads publish events at the same time so that an event may be lost and the following error is logged.

      java.lang.RuntimeException: HotEventBus.publish(KeyedEvent(NoKey,InfoLogged(SCHEDULER-962  Protocol ends in </path/to/logfile>))): ignoring the event triggered by handling the event 'null'
         at scala.sys.package$.error(package.scala:27)
         at com.sos.scheduler.engine.eventbus.HotEventBus.handleRecursiveEvent(HotEventBus.scala:27)
         at com.sos.scheduler.engine.eventbus.HotEventBus.publish(HotEventBus.scala:19)
         at com.sos.scheduler.engine.eventbus.HotEventBus.publish(HotEventBus.scala:15)
         at com.sos.scheduler.engine.eventbus.SchedulerEventBus.publish(SchedulerEventBus.scala:79)
         at com.sos.scheduler.engine.kernel.event.EventSubsystem.reportEventClass(EventSubsystem.scala:35)
         at com.sos.scheduler.engine.kernel.cppproxy.Timed_callCImpl.call__native(Native Method)
         at com.sos.scheduler.engine.kernel.cppproxy.Timed_callCImpl.call(Timed_callCImpl.java:31)
         at com.sos.scheduler.engine.kernel.async.CppCall.call(CppCall.scala:25)
         at com.sos.scheduler.engine.kernel.async.CppCall.call(CppCall.scala:10)
         at com.sos.scheduler.engine.common.async.TimedCall$$anonfun$1.apply(TimedCall.scala:21)
         at scala.util.Try$.apply(Try.scala:192)
         at com.sos.scheduler.engine.common.async.TimedCall$class.onApply(TimedCall.scala:21)
         at com.sos.scheduler.engine.kernel.async.CppCall.onApply(CppCall.scala:10)
         at com.sos.scheduler.engine.common.async.CallRunner.f$1(CallRunner.scala:36)
         at com.sos.scheduler.engine.common.async.CallRunner.executeMatureCalls(CallRunner.scala:42)
         at com.sos.scheduler.engine.kernel.Scheduler$$anonfun$executeCallQueue$1.apply$mcZ$sp(Scheduler.scala:206)
         at com.sos.scheduler.engine.kernel.Scheduler$$anonfun$executeCallQueue$1.apply(Scheduler.scala:206)
         at com.sos.scheduler.engine.kernel.Scheduler$$anonfun$executeCallQueue$1.apply(Scheduler.scala:206)
         at com.sos.scheduler.engine.kernel.async.SchedulerThreadFutures$.inSchedulerThread(SchedulerThreadFutures.scala:15)
         at com.sos.scheduler.engine.kernel.Scheduler.executeCallQueue(Scheduler.scala:206)
         at com.sos.scheduler.engine.kernel.Scheduler.onEnteringSleepState(Scheduler.scala:200)
      

      In above example it affects that the line SCHEDULER-962 Protocol ends in </path/to/logfile> could not be written in the scheduler.log.

      Desired Behavior

      In a Plugin, inject ColdEventBus instead of EventBus or SchedulerEventBus.
      ColdEventBus is thread-safe.

      Attachments

        Activity

          People

            jz Joacim Zschimmer
            jz Joacim Zschimmer
            Oliver Haufe Oliver Haufe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: