Diagnostic: enhanced resume error with VM frame names, clear stale reuse on re-suspend
The Not callable: nil error happens on a stub VM (frames=[], sp=0) during cek_resume with 12 CEK kont frames. The error is from a reactive signal subscriber (reset! current ...) that triggers during run vm after resume. The subscriber callback goes through CEK via cek_call_or_suspend and the CEK continuation tries to call nil. This is a reactive subscriber notification issue, not a perform/resume frame management issue. The VM frames are correctly restored — the error happens during a synchronous reset! call within the resumed VM execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -132,11 +132,15 @@ let rec value_to_js (v : value) : Js.Unsafe.any =
|
||||
(* Return suspension object — the JS driveAsync caller handles scheduling *)
|
||||
Js.Unsafe.inject (make_suspension req2 vm2)
|
||||
| Eval_error msg ->
|
||||
(* Enhanced error: show pending_cek kont and reuse_stack info *)
|
||||
let extra = Printf.sprintf " [vm: pending_cek=%b reuse=%d frames=%d]"
|
||||
(* Enhanced error: show pending_cek kont, reuse_stack, and VM frame info *)
|
||||
let vm_frame_names = String.concat "," (List.map (fun f ->
|
||||
match f.Sx_vm.closure.Sx_types.vm_name with Some n -> n | None -> "?"
|
||||
) v.Sx_vm.frames) in
|
||||
let extra = Printf.sprintf " [vm: pending_cek=%b reuse=%d frames=[%s] sp=%d]"
|
||||
(v.Sx_vm.pending_cek <> None)
|
||||
(List.length v.Sx_vm.reuse_stack)
|
||||
(List.length v.Sx_vm.frames) in
|
||||
vm_frame_names
|
||||
v.Sx_vm.sp in
|
||||
ignore (Js.Unsafe.meth_call
|
||||
(Js.Unsafe.get Js.Unsafe.global (Js.string "console"))
|
||||
"error" [| Js.Unsafe.inject (Js.string ("[sx] resume: " ^ msg ^ extra)) |]);
|
||||
@@ -549,9 +553,17 @@ let rec make_js_callFn_suspension request vm =
|
||||
| Sx_vm.VmSuspended (req2, vm2) ->
|
||||
Js.Unsafe.inject (make_js_callFn_suspension req2 vm2)
|
||||
| Eval_error msg ->
|
||||
let vm_frame_names = String.concat "," (List.map (fun f ->
|
||||
match f.Sx_vm.closure.Sx_types.vm_name with Some n -> n | None -> "?"
|
||||
) vm.Sx_vm.frames) in
|
||||
let extra = Printf.sprintf " [vm: pending_cek=%b reuse=%d frames=[%s] sp=%d]"
|
||||
(vm.Sx_vm.pending_cek <> None)
|
||||
(List.length vm.Sx_vm.reuse_stack)
|
||||
vm_frame_names
|
||||
vm.Sx_vm.sp in
|
||||
ignore (Js.Unsafe.meth_call
|
||||
(Js.Unsafe.get Js.Unsafe.global (Js.string "console"))
|
||||
"error" [| Js.Unsafe.inject (Js.string ("[sx] resume: " ^ msg)) |]);
|
||||
"error" [| Js.Unsafe.inject (Js.string ("[sx] resume: " ^ msg ^ extra)) |]);
|
||||
Js.Unsafe.inject Js.null));
|
||||
obj
|
||||
|
||||
|
||||
Reference in New Issue
Block a user