Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTimeout sometimes doesn't trigger for a long time. #33372

Closed
aksprncs opened this issue May 12, 2020 · 1 comment
Closed

setTimeout sometimes doesn't trigger for a long time. #33372

aksprncs opened this issue May 12, 2020 · 1 comment
Labels
timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Comments

@aksprncs
Copy link

Node Version: 4.8.x
Linux METRICS03 4.15.0-1071-azure #76-Ubuntu SMP Wed Feb 12 03:02:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux-->

What steps will reproduce the bug?

  1. Set a timeout to call another function foo.
  2. Do some processing in foo and post processing set a timeout to call foo again.

It is observed that after numerous repetition foo doesn't get called at scheduled interval. Instead foo is called 3-4 hours later (sometimes even longer).

main() function is called when service starts.
`
var timerIntervalForJobProcess = 156060*1000;
main(){
processJob("abc")
}

var processJob = function(client){
logger.debug("in processJob");
processJobRecord(client)
.then(function (result) {
setNextExecutionForClient(client);
})
.catch(function (err) {
setNextExecutionForClient(client);
});
}

var setNextExecutionForClient = function (client) {
logger.info("Attempting to schedule job processing to execute again after " + timerIntervalForJobProcess + " milliseconds" + "for client: "+ client);
setTimeout(function(client) {
logger.info("in anonymous function in setNextExecutionForClient going to call processJob for client: "+ client);
processJob(client);
},
timerIntervalForJobProcess, client);
logger.info("Successfully scheduled job processing to execute again after " + timerIntervalForJobProcess + " milliseconds" + "for client: "+ client);
}`

How often does it reproduce? Is there a required condition?

It is happening approximately once in a week. Issue is observed randomly.

What is the expected behaviour?

Timeout scheduled function should execute close to 15 minutes. Few minut delay is okay but 3-4 hours of delay is not durable in the service.

@BridgeAR
Copy link
Member

@aksprncs I am sorry but we do not support Node.js version 4 since multiple years by now. Please upgrade to a newer Node.js version and check if the issue persists. If it does, please open a new issue.

@BridgeAR BridgeAR added the timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

No branches or pull requests

2 participants