denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.79k stars 5.34k forks source link

Snapshot fail if inspector is enabled #17793

Open bakjos opened 1 year ago

bakjos commented 1 year ago

When trying to create a new snapshot after 1.30+(it was working well on 1.29.4) using inspection = true,

 let mut runtime = JsRuntime::new(RuntimeOptions {
        will_snapshot: true,
        inspector: true,
        ..Default::default()
      });
//... execute some scripts
//This fails
 runtime.snapshot()
...

Fails with unknown external reference

0xfc4002edee9: [SharedFunctionInfo] in OldSpace
 - map: 0x0fc400002625 <Map[40](SHARED_FUNCTION_INFO_TYPE)>
 - name: 0x0fc4002ede85 <String[10]: #createTask>
 - kind: ConciseMethod
 - syntax kind: AnonymousExpression
 - function_map_index: 205
 - formal_parameter_count: 0
 - expected_nof_properties: 0
 - language_mode: sloppy
 - data: 0x0fc4002ede9d <FunctionTemplateInfo>
 - code (from data): 0x0fc40018b625 <CodeDataContainer BUILTIN HandleApiCall>
 - script: 0x0fc4000023e1 <undefined>
 - function token position: 0
 - start position: 0
 - end position: 0
 - no debug info
 - scope info: 0x0fc400002765 <ScopeInfo>
 - length: 0
 - feedback_metadata: <none>

0xfc4002ede9d: [FunctionTemplateInfo] in OldSpace
 - map: 0x0fc4000076b1 <Map[60](FUNCTION_TEMPLATE_INFO_TYPE)>
 - class name: 0x0fc4000023e1 <undefined>
 - tag: 0
 - serial_number: -1
 - property_list: 0x0fc4000023e1 <undefined>
 - call_code: 0x0fc4002eded9 <CallHandlerInfo callback= 0x101ac8b70, data= 0x0fc4002c2ed5 !!!INVALID CONSTRUCTOR!!!>, side_effect_free= false>
 - property_accessors: 0x0fc4000023e1 <undefined>
 - signature: 0x0fc4000023e1 <undefined>
 - cached_property_name: 0x0fc400002459 <the_hole>
 - undetectable: false
 - need_access_check: false
 - instantiated: true
 - rare_data: 0x0fc4000023e1 <undefined>

0xfc4002eded9: [CallHandlerInfo] in OldSpace
 - map: 0x0fc400002d69 <Map[16](CALL_HANDLER_INFO_TYPE)>
 - callback: 0x101ac8b70
 - data: 0x0fc4002c2ed5 !!!INVALID CONSTRUCTOR!!!>
 - side_effect_free: false

0xfc4002c2ed5: [JS_EXTERNAL_OBJECT_TYPE] in OldSpace
 - map: 0x0fc40018441d <Map[20](HOLEY_ELEMENTS)> [FastProperties]
 - prototype: 0x0fc400002261 <null>
 - elements: 0x0fc400002259 <FixedArray[0]> [HOLEY_ELEMENTS]
 - external value: 0x106404690
 - properties: 0x0fc400002259 <FixedArray[0]>
 - All own properties (excluding elements): {}

Unknown external reference 0x106404690.
<unresolved>
aapoalas commented 1 year ago

This is may be regression related to https://github.com/denoland/deno/pull/17460

bartlomieju commented 1 year ago

We can look into the issue after 1.31 is released and changes to deno_core stop being so frequent.

That said, could you provide full reproduction code?

bakjos commented 1 year ago

Even something simple like

let mut runtime = JsRuntime::new(RuntimeOptions {
        will_snapshot: true,
        inspector: true,
        ..Default::default()
      });
 runtime.snapshot()

fails