Uploaded image for project: 'Red Hat OpenBridge'
  1. Red Hat OpenBridge
  2. MGDOBR-436

Workers: Interleaved execution for same work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • None
    • None
    • None
    • None
    • OpenBridge Sprint 216

      A Worker performs the Work for a ManagedResource.

      When Work is first requested the request is stored in the database and triggered by a sending an Event to VertX's EventBus. Great. At periodic intervals WorkManager has a @Scheduled method that looks for Work on the database and re-triggers it by firing more events to VertX's EventBus. Not so great. Some of the Work that is re-triggered is still in progress on another thread leading to race conditions and optimistic lock exceptions.

      We need to implement a strategy to prevent this from happening.

      2022-03-15 09:15:59,761 INFO  [com.red.ser.bri.man.ProcessorServiceImpl] (executor-thread-1) Processor with id '918accfd-a7b0-4bce-8068-5bc57d6bb91c' for customer '1608dc1f-4139-49c5-ae22-afe73ed807d7' on bridge '8e4fd1ec-cee4-4248-983d-65853dbea2d5' has been marked for creation
      2022-03-15 09:15:59,887 INFO  [com.red.ser.bri.man.wor.WorkManagerImpl] (executor-thread-1) Scheduling work for '918accfd-a7b0-4bce-8068-5bc57d6bb91c' [com.redhat.service.bridge.manager.models.Processor]
      2022-03-15 09:15:59,889 INFO  [com.red.ser.bri.man.wor.WorkManagerImpl] (executor-thread-1) Executing work for '918accfd-a7b0-4bce-8068-5bc57d6bb91c' [com.redhat.service.bridge.manager.models.Processor]
      2022-03-15 09:15:59,968 INFO  [com.red.ser.bri.man.wor.res.ProcessorWorker] (executor-thread-1) Creating dependencies for 'lmolteni-2022-03-15-processor' [918accfd-a7b0-4bce-8068-5bc57d6bb91c]
      2022-03-15 09:16:00,000 INFO  [com.red.ser.bri.man.wor.res.ConnectorWorker] (executor-thread-1) Creating dependencies for 'OpenBridge-slack_sink_0.1-918accfd-a7b0-4bce-8068-5bc57d6bb91c' [4530df21-456c-4cfe-928b-0da6012ade6e]
      2022-03-15 09:16:00,007 INFO  [com.red.ser.bri.man.wor.WorkManagerImpl] (executor-thread-0) Executing work for '918accfd-a7b0-4bce-8068-5bc57d6bb91c' [com.redhat.service.bridge.manager.models.Processor]
      

      Triggered by scheduling "new" work:

      2022-03-15 09:15:59,887 INFO  [com.red.ser.bri.man.wor.WorkManagerImpl] (executor-thread-1) Scheduling work for '918accfd-a7b0-4bce-8068-5bc57d6bb91c' [com.redhat.service.bridge.manager.models.Processor]
      2022-03-15 09:15:59,889 INFO  [com.red.ser.bri.man.wor.WorkManagerImpl] (executor-thread-1) Executing work for '918accfd-a7b0-4bce-8068-5bc57d6bb91c' [com.redhat.service.bridge.manager.models.Processor]
      

      Triggered by the @Scheduled method:

      2022-03-15 09:16:00,007 INFO  [com.red.ser.bri.man.wor.WorkManagerImpl] (executor-thread-0) Executing work for '918accfd-a7b0-4bce-8068-5bc57d6bb91c' [com.redhat.service.bridge.manager.models.Processor]
      

              manstis@redhat.com Michael Anstis
              manstis@redhat.com Michael Anstis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: