Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-1116

Race condition with multiple job executor threads on Oracle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Critical
    • None
    • 6.1.0
    • jBPM Core
    • None
    • ER1
    • +
    • Hide
      When using AsyncWorkItemHandler with Oracle Weblogic, a job can be picked up by two threads if the thread pool is larger than one. For queries which use rownum + for update, Hibernate breaks the query in two. This allows for the same job being processed by different AvailableJobsExecutor threads. To work around the issue, use custom dialect Oracle10gDialect that disables follow on locking and allows you to configure initial delay of executor work threads so they are not firing at exact same time.
      Show
      When using AsyncWorkItemHandler with Oracle Weblogic, a job can be picked up by two threads if the thread pool is larger than one. For queries which use rownum + for update, Hibernate breaks the query in two. This allows for the same job being processed by different AvailableJobsExecutor threads. To work around the issue, use custom dialect Oracle10gDialect that disables follow on locking and allows you to configure initial delay of executor work threads so they are not firing at exact same time.

    Description

      Description of problem:
      When using AsyncWorkItemHandler with Oracle, a job can be picked up by two threads when the thread pool size is larger than 1. For queries which use rownum + for update, Hibernate issues not a single query, but breaks this up in two. This allows for the same job being processed by different AvailableJobsExecutor threads:

      2015-06-21 12:53:58,489 DEBUG [org.jbpm.executor.impl.AvailableJobsExecutor] (EJB default - 10) Executor Thread org.jbpm.executor.impl.AvailableJobsExecutor@434eb850 Waking Up!!!
      2015-06-21 12:53:58,489 DEBUG [org.jbpm.executor.impl.AvailableJobsExecutor] (EJB default - 9) Executor Thread org.jbpm.executor.impl.AvailableJobsExecutor@6d182f77 Waking Up!!!
      2015-06-21 12:53:58,490 INFO [stdout] (EJB default - 10) Hibernate: select * from ( select requestinf0_.id...) ) where rownum <= ?

      2015-06-21 12:53:58,492 INFO [stdout] (EJB default - 9) Hibernate: select * from ( select requestinf0_.id ...) ) where rownum <= ?

      2015-06-21 12:53:58,556 INFO [stdout] (EJB default - 10) Hibernate: select id from RequestInfo where id =? for update

      2015-06-21 12:53:58,559 INFO [stdout] (EJB default - 9) Hibernate: select id from RequestInfo where id =? for update

      This shows that both threads can obtain the same job instance, as outlined in the related Hibernate issue:
      "Yes it does allow a slight possibility that a row might be updated or locked between the initial select (paging) and the subsequent lock attempt." from https://hibernate.atlassian.net/browse/HHH-1168?focusedCommentId=48846&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-48846

      Attachments

        Issue Links

          Activity

            People

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-mputz Martin Weiler (Inactive)
              Tomáš Livora Tomáš Livora (Inactive)
              Tomáš Livora Tomáš Livora (Inactive)
              Alessandro Lazarotti, Kris Verlaenen, Lyle Wang (Inactive), Maciej Swiderski (Inactive), Marek Czernek (Inactive), Oscar Molina, Tomáš Livora (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: