{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/7722","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/7722/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/7722/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/7722/events","html_url":"https://github.com/nodejs/node/issues/7722","id":165461915,"number":7722,"title":"clearTimeout with invalid handle cause program runs longer","user":{"login":"tdzl2003","id":3185808,"avatar_url":"https://avatars.githubusercontent.com/u/3185808?v=3","gravatar_id":"","url":"https://api.github.com/users/tdzl2003","html_url":"https://github.com/tdzl2003","followers_url":"https://api.github.com/users/tdzl2003/followers","following_url":"https://api.github.com/users/tdzl2003/following{/other_user}","gists_url":"https://api.github.com/users/tdzl2003/gists{/gist_id}","starred_url":"https://api.github.com/users/tdzl2003/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdzl2003/subscriptions","organizations_url":"https://api.github.com/users/tdzl2003/orgs","repos_url":"https://api.github.com/users/tdzl2003/repos","events_url":"https://api.github.com/users/tdzl2003/events{/privacy}","received_events_url":"https://api.github.com/users/tdzl2003/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/timers","name":"timers","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-14T02:20:46Z","updated_at":"2016-07-14T09:39:53Z","closed_at":"2016-07-14T09:39:53Z","body":"<!--\r\nThank you for reporting an issue.\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n-->\r\n\r\n* **Version**: Tested on 6.0.0\r\n* **Platform**: Tested on Windows & MacOS\r\n* **Subsystem**: Timer\r\n\r\n<!-- Enter your issue details below this comment. -->\r\n\r\nThis program cost 20 seconds, but 10.5 seconds was expected:\r\n\r\n```javascript\r\nvar handle = setTimeout(function(){\r\n\tclearTimeout(handle);\r\n\thandle = setTimeout( function() {\r\n\t}, 10000 );\r\n\tsetTimeout( function() {\r\n\t\tclearTimeout( handle );\r\n\t}, 500 );\r\n}, 10000);\r\n```\r\n\r\nBut all below codes work as expected:\r\n\r\n```javascript\r\nvar handle = setTimeout(function(){\r\n\tclearTimeout(handle);\r\n\thandle = setTimeout( function() {\r\n\t}, 10000 );\r\n\tsetTimeout( function() {\r\n\t\tclearTimeout( handle );\r\n\t}, 500 );\r\n}, 2000);  // <-- different delay \r\n```\r\n\r\n```javascript\r\nvar handle = setTimeout(function(){\r\n        //clearTimeout(handle);  <-- comment this line.\r\n\thandle = setTimeout( function() {\r\n\t}, 10000 );\r\n\tsetTimeout( function() {\r\n\t\tclearTimeout( handle );\r\n\t}, 500 );\r\n}, 10000);\r\n```\r\n\r\nDoes clearTimeout with a invalid handle causes this problem?"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/232617144","html_url":"https://github.com/nodejs/node/issues/7722#issuecomment-232617144","issue_url":"https://api.github.com/repos/nodejs/node/issues/7722","id":232617144,"user":{"login":"Fishrock123","id":1093990,"avatar_url":"https://avatars.githubusercontent.com/u/1093990?v=3","gravatar_id":"","url":"https://api.github.com/users/Fishrock123","html_url":"https://github.com/Fishrock123","followers_url":"https://api.github.com/users/Fishrock123/followers","following_url":"https://api.github.com/users/Fishrock123/following{/other_user}","gists_url":"https://api.github.com/users/Fishrock123/gists{/gist_id}","starred_url":"https://api.github.com/users/Fishrock123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fishrock123/subscriptions","organizations_url":"https://api.github.com/users/Fishrock123/orgs","repos_url":"https://api.github.com/users/Fishrock123/repos","events_url":"https://api.github.com/users/Fishrock123/events{/privacy}","received_events_url":"https://api.github.com/users/Fishrock123/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T09:39:53Z","updated_at":"2016-07-14T09:39:53Z","body":"The following code works:\r\n\r\n```js\r\nvar handle = setTimeout(function() {\r\n\r\n  clearTimeout(handle)\r\n\r\n  var _handle = setTimeout(function() {}, 10001)\r\n\r\n  setTimeout(function() {\r\n    clearTimeout(_handle);\r\n  }, 500)\r\n\r\n}, 10000)\r\n```\r\n\r\nThis is a more elaborate form of https://github.com/nodejs/node/issues/5426 which will be fixed by https://github.com/nodejs/node/pull/3063"}}
{"actor":{"display_login":"Fishrock123"}}