Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix JavaScript crashes in Elm app build by switching from Jint to V8
Recently, crashes in the Jint JavaScript engine increased significantly, causing most runs on GitHub Actions to fail. Following is an excerpt from one of these crashes: ----- 2024-10-06T10:14:20.2060060Z Passed Apply_function_via_admin_interface_report_from_calculator [3 s] 2024-10-06T10:14:20.4923380Z Unhandled exception. Jint.Runtime.JavaScriptException: value is not defined 2024-10-06T10:14:20.4938090Z ---> Error: value is not defined 2024-10-06T10:14:20.5009190Z at fun.f (func, acc, list) :2721:30 2024-10-06T10:14:20.5021640Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5026610Z at $elm$json$Json$Encode$object (pairs) :4042:3 2024-10-06T10:14:20.5030370Z at func (type_arg_) :6207:26 2024-10-06T10:14:20.5031150Z at fun.f (entry, array) :1637:27 2024-10-06T10:14:20.5031640Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5032080Z at fun.f (func, acc, list) :2721:18 2024-10-06T10:14:20.5032870Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5033450Z at fun.f (func, entries) :4889:4 2024-10-06T10:14:20.5033930Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5039000Z at func (type_arg) :6204:17 2024-10-06T10:14:20.5040820Z at fun.f (entry, array) :1637:27 2024-10-06T10:14:20.5042680Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5044590Z at fun.f (func, acc, list) :2721:18 2024-10-06T10:14:20.5045740Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5046760Z at fun.f (func, entries) :4889:4 2024-10-06T10:14:20.5048010Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5049900Z at $author$project$Backend$InterfaceToHost_Root$Generated_4e7b4acf$jsonEncode_Backend_Generated_StateShimTypes_StateShimResponse (valueToEncode) :6176:10 2024-10-06T10:14:20.5051640Z at func (type_arg) :6327:11 2024-10-06T10:14:20.5052180Z at fun.f (entry, array) :1637:27 2024-10-06T10:14:20.5052650Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5053080Z at fun.f (func, acc, list) :2721:18 2024-10-06T10:14:20.5053690Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5054150Z at fun.f (func, entries) :4889:4 2024-10-06T10:14:20.5054920Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5055480Z at fun.f (encodeErr, encodeOk, valueToEncode) :6074:7 2024-10-06T10:14:20.5056440Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5057460Z at $author$project$Backend$InterfaceToHost_Root$Generated_4e7b4acf$jsonEncode_ae58ba72a1 (valueToEncode) :6321:9 2024-10-06T10:14:20.5058530Z at fun (f, g, x) :3508:4 2024-10-06T10:14:20.5058930Z at func (c) :15:54 2024-10-06T10:14:20.5059310Z at fun.f (func, _v0) :3476:4 2024-10-06T10:14:20.5060190Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5060980Z at fun (config, serializedEvent, stateBefore) :6717:10 2024-10-06T10:14:20.5062340Z at $author$project$Backend$InterfaceToHost_Root$interfaceToHost_processEvent (c) :15:54 2024-10-06T10:14:20.5063360Z at serializedEvent (param_0, param_1) :6759:49 2024-10-06T10:14:20.5064210Z at _Json_wrap (value) :6763:27 2024-10-06T10:14:20.5064810Z at processEventAndUpdateState (eventSerial) :6215:22 2024-10-06T10:14:20.5065440Z at func (type_arg_) :6766:34 2024-10-06T10:14:20.5065900Z at fun.f (entry, array) :1637:27 2024-10-06T10:14:20.5066360Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5066800Z at fun.f (func, acc, list) :2721:18 2024-10-06T10:14:20.5067290Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5067720Z at fun.f (func, entries) :4889:4 2024-10-06T10:14:20.5068190Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5068870Z at func (type_arg) :6204:17 2024-10-06T10:14:20.5069500Z at fun.f (entry, array) :1637:27 2024-10-06T10:14:20.5070240Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5071160Z at fun.f (func, acc, list) :2721:18 2024-10-06T10:14:20.5071990Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5072550Z at fun.f (func, entries) :4889:4 2024-10-06T10:14:20.5073030Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5074350Z at $author$project$Backend$InterfaceToHost_Root$Generated_4e7b4acf$jsonEncode_Backend_Generated_StateShimTypes_StateShimResponse (valueToEncode) :6176:10 2024-10-06T10:14:20.5075750Z at func (type_arg) :6327:11 2024-10-06T10:14:20.5076210Z at fun.f (entry, array) :1637:27 2024-10-06T10:14:20.5076930Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5077650Z at fun.f (func, acc, list) :2721:18 2024-10-06T10:14:20.5078160Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5078610Z at fun.f (func, entries) :4889:4 2024-10-06T10:14:20.5396780Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5397840Z at fun.f (encodeErr, encodeOk, valueToEncode) :6074:7 2024-10-06T10:14:20.5398810Z at A3 (fun, a, b, c) :59:24 2024-10-06T10:14:20.5400040Z at $author$project$Backend$InterfaceToHost_Root$Generated_4e7b4acf$jsonEncode_ae58ba72a1 (valueToEncode) :6321:9 2024-10-06T10:14:20.5401560Z at fun (f, g, x) :3508:4 2024-10-06T10:14:20.5402250Z at func (c) :15:54 2024-10-06T10:14:20.5403060Z at fun.f (func, _v0) :3476:4 2024-10-06T10:14:20.5407960Z at A2 (fun, a, b) :56:24 2024-10-06T10:14:20.5408600Z at fun (config, serializedEvent, stateBefore) :6717:10 2024-10-06T10:14:20.5409760Z at $author$project$Backend$InterfaceToHost_Root$interfaceToHost_processEvent (c) :15:54 2024-10-06T10:14:20.5411420Z at serializedEvent (param_0, param_1) :6759:49 2024-10-06T10:14:20.5412190Z at processEventAndUpdateState (eventSerial) :6763:27 2024-10-06T10:14:20.5412810Z at :6766:34 2024-10-06T10:14:20.5413410Z --- End of inner exception stack trace --- 2024-10-06T10:14:20.5415350Z at Jint.Runtime.ExceptionHelper.ThrowJavaScriptException(Engine engine, JsValue value, Completion& result) 2024-10-06T10:14:20.5417040Z at Jint.Native.Function.ScriptFunction.Call(JsValue thisObject, JsValue[] arguments) 2024-10-06T10:14:20.5418940Z at Jint.Engine.<>c__DisplayClass111_0.<Invoke>g__DoInvoke|0() 2024-10-06T10:14:20.5419940Z at Jint.Engine.ExecuteWithConstraints[T](Boolean strict, Func`1 callback) 2024-10-06T10:14:20.5421060Z at Jint.Engine.Invoke(JsValue value, Object thisObj, Object[] arguments) 2024-10-06T10:14:20.5422340Z at Jint.Engine.Invoke(String propertyName, Object thisObj, Object[] arguments) 2024-10-06T10:14:20.5423540Z at Jint.Engine.Invoke(String propertyName, Object[] arguments) 2024-10-06T10:14:20.5425710Z at ElmTime.JavaScript.JavaScriptEngineJint.CallFunction(String functionName, Object[] args) in /Users/runner/work/pine/pine/implement/pine/JavaScript/JavaScriptEngineJint.cs:line 53 2024-10-06T10:14:20.5428660Z at ElmTime.ProcessHostedWithJavaScriptEngine.ProcessEvent(String serializedEvent) in /Users/runner/work/pine/pine/implement/pine/ElmTime/Process.cs:line 61 2024-10-06T10:14:20.5432190Z at ElmTime.StateShim.StateShim.ProcessStateShimRequest(IProcess`2 process, StateShimRequestStruct stateShimRequest) in /Users/runner/work/pine/pine/implement/pine/ElmTime/StateShim/StateShim.cs:line 288 2024-10-06T10:14:20.5435680Z at ElmTime.StateShim.StateShim.ListExposedFunctions(IProcess`2 process) in /Users/runner/work/pine/pine/implement/pine/ElmTime/StateShim/StateShim.cs:line 75 ----- The declaration's name mentioned in the error message from Jint ('value' in the quoted case) differs between crashes. Since we did not observe nearly as many crashes when using V8 (maybe none at all), this commit switches the default engine from Jint to V8.
- Loading branch information