{"action":"created","issue":{"url":"https://api.github.com/repos/ariya/phantomjs/issues/13497","labels_url":"https://api.github.com/repos/ariya/phantomjs/issues/13497/labels{/name}","comments_url":"https://api.github.com/repos/ariya/phantomjs/issues/13497/comments","events_url":"https://api.github.com/repos/ariya/phantomjs/issues/13497/events","html_url":"https://github.com/ariya/phantomjs/issues/13497","id":100862218,"number":13497,"title":"phantomjs infinite hang on exception","user":{"login":"pleasantone","id":5339793,"avatar_url":"https://avatars.githubusercontent.com/u/5339793?v=3","gravatar_id":"","url":"https://api.github.com/users/pleasantone","html_url":"https://github.com/pleasantone","followers_url":"https://api.github.com/users/pleasantone/followers","following_url":"https://api.github.com/users/pleasantone/following{/other_user}","gists_url":"https://api.github.com/users/pleasantone/gists{/gist_id}","starred_url":"https://api.github.com/users/pleasantone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pleasantone/subscriptions","organizations_url":"https://api.github.com/users/pleasantone/orgs","repos_url":"https://api.github.com/users/pleasantone/repos","events_url":"https://api.github.com/users/pleasantone/events{/privacy}","received_events_url":"https://api.github.com/users/pleasantone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-13T20:35:33Z","updated_at":"2015-08-14T08:05:21Z","closed_at":null,"body":"Self-compiled, debian, linux 64 bit image, no modifications, from github master as of July 16th, also\r\ntested against phantomjs 1.9.2 linux 64 bit official build.\r\n\r\n````\r\n$ cat bar.js\r\nthrow \"test exception\";\r\n:~/inteld$ phantomjs bar.js\r\ntest exception\r\n\r\n  bar.js:2 in global code\r\n\r\n<execution hangs at this point>\r\n````\r\n\r\nI would think the expected behavior would be for phantomjs to exit.  Failing that, since it's a \"browser\",\r\nthen it certainly should be able to do *something* after the exception.\r\n\r\n````\r\n$ cat baz.js\r\nconsole.log(\"one\");\r\nthrow \"test exception\";\r\nconsole.log(\"two\");\r\nthrow \"test exception 2\";\r\nconsole.log(\"three\");\r\n$ phantomjs baz.js\r\none\r\ntest exception\r\n\r\n  baz.js:2 in global code\r\n^C\r\n````\r\n\r\nI find this disturbing, because I'm using phantomjs with the casperjs framework and there doesn't appear to be a good way to recover from this."},"comment":{"url":"https://api.github.com/repos/ariya/phantomjs/issues/comments/131012602","html_url":"https://github.com/ariya/phantomjs/issues/13497#issuecomment-131012602","issue_url":"https://api.github.com/repos/ariya/phantomjs/issues/13497","id":131012602,"user":{"login":"YuriIvanov","id":4580842,"avatar_url":"https://avatars.githubusercontent.com/u/4580842?v=3","gravatar_id":"","url":"https://api.github.com/users/YuriIvanov","html_url":"https://github.com/YuriIvanov","followers_url":"https://api.github.com/users/YuriIvanov/followers","following_url":"https://api.github.com/users/YuriIvanov/following{/other_user}","gists_url":"https://api.github.com/users/YuriIvanov/gists{/gist_id}","starred_url":"https://api.github.com/users/YuriIvanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YuriIvanov/subscriptions","organizations_url":"https://api.github.com/users/YuriIvanov/orgs","repos_url":"https://api.github.com/users/YuriIvanov/repos","events_url":"https://api.github.com/users/YuriIvanov/events{/privacy}","received_events_url":"https://api.github.com/users/YuriIvanov/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T08:05:21Z","updated_at":"2015-08-14T08:05:21Z","body":"@pleasantone I'm looking at source code now and can say that it's not \"exception\" bug. Phantom will fall in infinite loop if you not explicitly shot down it in your js code by calling\r\n```javascript\r\nphantom.exit();\r\n```\r\nPhantomJs does not handle exceptions itself. So when you have unhanled exception in your js, script just stop to execute and does not reach phantom.exit()."}}