Increased CPU usage (+40%) - due to scheduled task threads

Description

Hello,
I recently upgraded Lucee from 5.2.1.9 to 5.3.8.138-SNAPSHOT and am seeing a considerable increase in CPU usage (+40%~).

This graph shows the CPU usage. The point where CPU usage increases coincides with the update of the Lucee version.

Environment

Version: Lucee 5.3.8.138-SNAPSHOT
Servlet Container: Apache Tomcat/9.0.19
Java: 11.0.8 (AdoptOpenJDK) 64bit
OS : Linux (4.15.0-130-generic) 64bit

Activity

Show:
Pothys - MitrahSoft
March 9, 2021, 12:15 PM

I've checked with lucee version 5.3.8.156-SNAPSHOT. This issue was fixed. No CPU usage was increased.

Michael Offner
March 9, 2021, 9:03 AM

please give this another try

Michael Offner
March 8, 2021, 7:36 PM

it happen in the calculation of DST offset compensation when the interval is bigger than an hour

Tony Monast
February 17, 2021, 1:05 PM

When I have only my scheduled task “To Infinity and Beyond“ with the starting time at 00:00:00 and interval at 14400, here what I see with performance analyzer plugin

The last column is the CPU time. After few seconds I see CPU time jumping at 286,281.25, then 316,234.38, then 332,750.00, and going up and up and up…

I tried to find a pattern for the bug. It’s directly related to the scheduled task interval :

  • 10000 (2,777778 hours) ok

  • 10400 (2,8888889 hours) ok

  • 10800 (3 hours) bug

  • 10810 (3,0027778 hours) ok

  • 14400 (4 hours) bug

  • 14700 (4,0833333 hours) ok

  • 18000 (5 hours) ok

At first I thought it was coming from a rounding issue and/or data type (int vs float), because it was buggy just with whole number like 3 and 4 hours, but it’s okay with 5 hours. It’s strange.

For now I just changed the interval 14400 to 14700 for my problematics scheduled tasks and the Lucee CPU dropped at 0%.

Note that if my scheduled task use an interval of 14400 and start at {t ‘06:00:00’}, it’s fine. But if it’s start at 00:00:00, or 00:30:00, or 01:00:00 the bug still occur. This is indeed a bug depending on the combination of start time and interval, and maybe end time as well.

Zac Spitzer
February 16, 2021, 3:19 PM

discussion on the dev forum

https://dev.lucee.org/t/high-cpu-usage/7950/20

My Performance Analyzer plugin now shows thread cpu time and the stack so you can easily see if you are hitting this bug

Fixed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Michael Offner

Reporter

Ionut Ivan

Priority

Critical

Fix versions