Device doesn't come online after server.sleepfor() time


I have an issue with the device wake up function. Normally Device takes the reading, sends it to agent and goes offline until server.sleepfor() timer hits. In few incidents i have a log as below, but the device never comes back online at the specified time. And its on a long sleep.

[Device] Sleeping until 2019-01-09 02:52:06Z

I need to make an explicit interrupt to bring the device online, after-that it works fine. I tried using server.onunexpecteddisconnect() as well to find the reason for the issue and restart the device, but onunexpecteddisconnect() function was never called due to intended disconnect. Any help on this issue?