{"action":"created","issue":{"url":"https://api.github.com/repos/iojs/io.js/issues/1128","labels_url":"https://api.github.com/repos/iojs/io.js/issues/1128/labels{/name}","comments_url":"https://api.github.com/repos/iojs/io.js/issues/1128/comments","events_url":"https://api.github.com/repos/iojs/io.js/issues/1128/events","html_url":"https://github.com/iojs/io.js/issues/1128","id":60743182,"number":1128,"title":"feature request: a way to inspect what's in the event loop","user":{"login":"joeybaker","id":36662,"avatar_url":"https://avatars.githubusercontent.com/u/36662?v=3","gravatar_id":"","url":"https://api.github.com/users/joeybaker","html_url":"https://github.com/joeybaker","followers_url":"https://api.github.com/users/joeybaker/followers","following_url":"https://api.github.com/users/joeybaker/following{/other_user}","gists_url":"https://api.github.com/users/joeybaker/gists{/gist_id}","starred_url":"https://api.github.com/users/joeybaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeybaker/subscriptions","organizations_url":"https://api.github.com/users/joeybaker/orgs","repos_url":"https://api.github.com/users/joeybaker/repos","events_url":"https://api.github.com/users/joeybaker/events{/privacy}","received_events_url":"https://api.github.com/users/joeybaker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/iojs/io.js/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/iojs/io.js/labels/ideas","name":"ideas","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-03-11T22:48:11Z","updated_at":"2015-04-08T14:41:05Z","closed_at":null,"body":"I recently struggled with debugging a test suite that wouldn't exit. The (tape) tests all finished, but the final result wasn't printed out and the process just hung. \r\n\r\nWe eventually tracked the problem down to a few long-running `setTimeout`s that, while fine in app code, needed to be cleared in the tests so that the process could exit. \r\n\r\nThis debugging process would have been a lot easier if there was a way to see what V8 had in the event loop, by call stack. Perhaps an API like:\r\n\r\n```js\r\n\r\nsetTimeout(() => {console.log('hi')}, 2000)\r\nsetTimeout(() => {console.log('hi')}, 1000)\r\n\r\nprocess.getEventLoop( (stacks) =>\r\n  stacks.forEach(console.log.bind(console))\r\n  // ['setTimeout file.js:2']\r\n  // ['setTimeout file.js:1']\r\n ```\r\n \r\n`stacks` is an array of arrays sorted by their order in the event loop and containing the call stack for each item. \r\n \r\n Does this already exist? Is it possible?"},"comment":{"url":"https://api.github.com/repos/iojs/io.js/issues/comments/90936257","html_url":"https://github.com/iojs/io.js/issues/1128#issuecomment-90936257","issue_url":"https://api.github.com/repos/iojs/io.js/issues/1128","id":90936257,"user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T14:41:05Z","updated_at":"2015-04-08T14:41:05Z","body":"Not really.  I added them a few years ago to make debugging a little easier for core devs.  They assume fairly deep understanding of the event loop's inner workings and probably aren't that useful for general purpose debugging (although many people do use them that way.)"}}