Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-89033

Same scheduler job may be executed in two threads at the same time

    Details

      Description

      When the interval of scheduled job is too small and the job itself is complex and take a lot of time to finish, it may happen that same job is executed in different thread at the same time.

      Here's the reproduction steps:
      1. Start a new master bundle and navigate to Control Panel > Configuration > System Settings > Web Content
      2. Navigate to VIRTUAL INSTANCE SCOPE > Web Content scroll near the bottom and set "Check Interval" to 1 then save
      3. Ensure the guest site groupId is correct in the attached script then run it from Server Administration > Script to create 5000 articles. (about 5 minutes)
      4. Shutdown bundle
      5. Update the database directly using this query `update JournalArticle set EXPIRATIONDATE ='2018-12-04 22:25:00.0' where EXPIRATIONDATE is null`
      6. Place breakpoints at these two points: https://github.com/joshuacords/liferay-portal/blob/76ce8bdb4fed27e72ecddacb48aae5e516cd22f3/modules/apps/journal/journal-service/src/main/java/com/liferay/journal/service/impl/JournalArticleLocalServiceImpl.java#L868 and https://github.com/joshuacords/liferay-portal/blob/d9fef8cce3e03b99265693e8a192829d9408bd8d/modules/apps/journal/journal-web/src/main/java/com/liferay/journal/web/internal/messaging/CheckArticleMessageListener.java#L81
      7. Start up the bundle and start debugging it. 
      8. Have the debugger continue after it hits the first breakpoint.
       
      Expected Behavior: debugger will reach the second breakpoint finishing the checkArticles methods before the task is started again.
      Actual Behavior: debugger will hit the first breakpoint a second time before it hits the last breakpoint and this attached error appears in the logs.

        Attachments

          Activity

            People

            • Assignee:
              yvonne.han Yvonne Han
              Reporter:
              tina.tian Tina Tian
              Participants of an Issue:
              Recent user:
              Clarissa Velazquez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 19 weeks ago

                Packages

                Version Package
                7.0.0 DXP FP73
                7.0.10.11 DXP SP11
                7.0.X
                7.1.10 DXP FP7
                7.1.10.2 SP2
                7.1.3 CE GA4
                7.1.X
                Master