{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/8","labels_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/8/comments","events_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/8/events","html_url":"https://github.com/Microsoft/ChakraCore/issues/8","id":125242661,"number":8,"title":"Allocation failed silently in some AsmJs tests","user":{"login":"dilijev","id":494055,"avatar_url":"https://avatars.githubusercontent.com/u/494055?v=3","gravatar_id":"","url":"https://api.github.com/users/dilijev","html_url":"https://github.com/dilijev","followers_url":"https://api.github.com/users/dilijev/followers","following_url":"https://api.github.com/users/dilijev/following{/other_user}","gists_url":"https://api.github.com/users/dilijev/gists{/gist_id}","starred_url":"https://api.github.com/users/dilijev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilijev/subscriptions","organizations_url":"https://api.github.com/users/dilijev/orgs","repos_url":"https://api.github.com/users/dilijev/repos","events_url":"https://api.github.com/users/dilijev/events{/privacy}","received_events_url":"https://api.github.com/users/dilijev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/ChakraCore/labels/Bug","name":"Bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"kunalspathak","id":12488060,"avatar_url":"https://avatars.githubusercontent.com/u/12488060?v=3","gravatar_id":"","url":"https://api.github.com/users/kunalspathak","html_url":"https://github.com/kunalspathak","followers_url":"https://api.github.com/users/kunalspathak/followers","following_url":"https://api.github.com/users/kunalspathak/following{/other_user}","gists_url":"https://api.github.com/users/kunalspathak/gists{/gist_id}","starred_url":"https://api.github.com/users/kunalspathak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunalspathak/subscriptions","organizations_url":"https://api.github.com/users/kunalspathak/orgs","repos_url":"https://api.github.com/users/kunalspathak/repos","events_url":"https://api.github.com/users/kunalspathak/events{/privacy}","received_events_url":"https://api.github.com/users/kunalspathak/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-01-06T19:19:49Z","updated_at":"2016-01-21T20:10:44Z","closed_at":null,"body":"When an OutOfMemory error occurred in ch.exe, the program crashed without logging an error message.\r\n\r\nThe exception in this particular case is thrown within the ArrayBuffer::ArrayBuffer constructor, but it is handled by code within ch.exe and it seems to be swallowed up without logging a message before the process dies.\r\n\r\n\r\nThe call stack that catches the OOM exception is here:\r\n\r\n```\r\n>\tChakraCore.dll!ContextAPIWrapper<0,_JsErrorCode <lambda>(Js::ScriptContext *) >(RunScriptCore::__l2::_JsErrorCode <lambda>(Js::ScriptContext *) fn) Line 155\tC++\r\n \tChakraCore.dll!RunScriptCore(const wchar_t * script, unsigned long sourceContext, const wchar_t * sourceUrl, bool parseOnly, void * * result) Line 2450\tC++\r\n \tChakraCore.dll!JsRunScript(const wchar_t * script, unsigned long sourceContext, const wchar_t * sourceUrl, void * * result) Line 2493\tC++\r\n \tch.exe!ChakraRTInterface::JsRunScript(const wchar_t * script, unsigned long sourceContext, const wchar_t * sourceUrl, void * * result) Line 178\tC++\r\n \tch.exe!RunScript(const wchar_t * fileName, const wchar_t * fileContents, unsigned char * bcBuffer, wchar_t * fullPath) Line 283\tC++\r\n \tch.exe!ExecuteTest(const wchar_t * fileName) Line 429\tC++\r\n \tch.exe!ExecuteTestWithMemoryCheck(wchar_t * fileName) Line 462\tC++\r\n \tch.exe!StaticThreadProc(void * lpParam) Line 484\tC++\r\n \tucrtbased.dll!551b8968()\tUnknown\r\n \t[Frames below may be incorrect and/or missing, no symbols loaded for ucrtbased.dll]\t\r\n \tucrtbased.dll!551b867b()\tUnknown\r\n \tkernel32.dll!762338f4()\tUnknown\r\n \tntdll.dll!77ae56c3()\tUnknown\r\n \tntdll.dll!77ae568e()\tUnknown\r\n```\r\n\r\n```\r\ncatch (Js::JavascriptExceptionObject *  exceptionObject)\r\n    {\r\n        scriptContext->GetThreadContext()->SetRecordedException(exceptionObject);\r\n        return JsErrorScriptException;\r\n    }\r\n```\r\n\r\nA useful error message might look like:\r\n\r\n```\r\nJavascriptError: Out of memory\r\n        at Global code (...\\path\\to\\blah.js:2:1)\r\n```\r\n\r\nTry running the following test case which will eventually force an OOM (on a 32-bit process):\r\n\r\n```js\r\nprint(\"hello\");\r\nvar buffer = [];\r\nfor (var i = 0; ; ++i) {\r\n    print(i);\r\n    buffer[i] = new ArrayBuffer(1<<30);\r\n}\r\nprint(\"world\");\r\n```\r\n\r\nNote: on a 64-bit process you'll just end up using up all your system's memory."},"comment":{"url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/comments/173694267","html_url":"https://github.com/Microsoft/ChakraCore/issues/8#issuecomment-173694267","issue_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/8","id":173694267,"user":{"login":"kunalspathak","id":12488060,"avatar_url":"https://avatars.githubusercontent.com/u/12488060?v=3","gravatar_id":"","url":"https://api.github.com/users/kunalspathak","html_url":"https://github.com/kunalspathak","followers_url":"https://api.github.com/users/kunalspathak/followers","following_url":"https://api.github.com/users/kunalspathak/following{/other_user}","gists_url":"https://api.github.com/users/kunalspathak/gists{/gist_id}","starred_url":"https://api.github.com/users/kunalspathak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunalspathak/subscriptions","organizations_url":"https://api.github.com/users/kunalspathak/orgs","repos_url":"https://api.github.com/users/kunalspathak/repos","events_url":"https://api.github.com/users/kunalspathak/events{/privacy}","received_events_url":"https://api.github.com/users/kunalspathak/received_events","type":"User","site_admin":false},"created_at":"2016-01-21T20:10:44Z","updated_at":"2016-01-21T20:10:44Z","body":"Yes. The output would be like:\r\n```text\r\nhello\r\n0\r\n1\r\nError: Out of memory\r\n```\r\n"}}