Affects Version/s: 7.0.X, 7.1.X, Master
Component/s: Portal Services > Scheduler
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.