I was trying to debug a issue for scheduleable class, I found out that it is taking approx 65,00,00,000 milliseconds which is equal to approx 180 hours. But if I open that debug logs and see execution time it is less than a second. enter image description here

enter image description here

I think there is something wrong how duration is calculated for schedule jobs. Any ideas why this might be happening.

My Scheduleable class that I am testing is just a blank class so it should not take that much time.

global class ScheduleClassLogTesting implements Schedulable{
    global void execute(SchedulableContext SC) {

Wrong values are only shown for schedulable jobs for all other operation debug logs are showing correct values.


This is an undocumented bug (at least as far as I can tell), but basically, it occurs in situations where the execution time is so small it causes an integer underflow, and instead returns an absurdly large value as a result. I do find it curious that you got such a "small" number, as this bug usually manifests as a duration of 2,147,483,647 milliseconds, which is equal to the binary value -1 as a signed 32 bit value.

Until/unless we get an official answer, we simply have no way of knowing the "why", all we know is that it can and does occur with very small execution times. I've ever specifically explored the limits of this, but it's likely only a problem if the time is less than a few milliseconds. By the way, I managed to get a value of 484,521,164 when I replicated your bug using nearly identical code. It seems that the bug is more random than it used to be.

This effect is completely harmless, aside from showing really large duration times in the debug logs. It doesn't mean that your code stalled for 180 hours, that you've invented time travel, or anything else. It's a simple integer underflow that you can safely ignore. I've known about this issue for years, I've just ignored it, since it doesn't have any real material effect, unless you're trying to do something with it, since logging is not always enabled, you wouldn't know or care about this under most normal circumstances.

  • Thanks @sfdcfox.. Actually I was just confused why it is happening and spent some time on going through code and debug logs... So just wanted to confirm whether it is just a known issue or something new that might have came up in new release of winter 20. – Manjot Singh Oct 16 '19 at 13:35
  • @ManjotSingh It's definitely not new, most people just don't happen to notice it, as it is pretty rare. – sfdcfox Oct 16 '19 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.