Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno.compile panic easy to reproduce #6747

Closed
sdhoward opened this issue Jul 14, 2020 · 3 comments · Fixed by #6758
Closed

Deno.compile panic easy to reproduce #6747

sdhoward opened this issue Jul 14, 2020 · 3 comments · Fixed by #6758
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@sdhoward
Copy link

Hi,

I'm running this version:

$ deno --version
deno 1.1.3
v8 8.5.216
typescript 3.9.2

Example code:

Deno.compile("main.js", {"main.js": "console.log(foo);"});

When I compile, I expect to get an exception or an error (yes, the code is obviously incorrect). I expect the Deno program to continue running after evaluating the expression. Instead, the Deno program panics and exits. If this is the same as #6423 then please advise.

$ deno run --unstable foo.js thread 'main' panicked at 'Can't downcast ErrBox(JSError(JSError { message: "Uncaught AssertionError: Unexpected skip of the emit.", source_line: None, script_resource_name: Some("$deno$/util.ts"), line_number: Some(35), start_column: Some(10), end_column: Some(11), frames: [JSStackFrame { type_name: Some("Object"), function_name: Some("assert"), method_name: Some("assert"), file_name: Some("$deno$/util.ts"), line_number: Some(35), column_number: Some(11), eval_origin: None, is_top_level: None, is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: Some(11) }, JSStackFrame { type_name: None, function_name: Some("runtimeCompile"), method_name: None, file_name: Some("$deno$/compiler.ts"), line_number: Some(1534), column_number: Some(3), eval_origin: None, is_top_level: None, is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: Some(3) }, JSStackFrame { type_name: Some("global"), function_name: Some("tsCompilerOnMessage"), method_name: Some("onmessage"), file_name: Some("$deno$/compiler.ts"), line_number: Some(1666), column_number: Some(22), eval_origin: None, is_top_level: None, is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: Some(22) }, JSStackFrame { type_name: None, function_name: Some("workerMessageRecvCallback"), method_name: None, file_name: Some("$deno$/runtime_worker.ts"), line_number: Some(72), column_number: Some(33), eval_origin: None, is_top_level: None, is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: Some(33) }, JSStackFrame { type_name: Some("global"), function_name: None, method_name: None, file_name: Some("file:///Users/schoward63/dev/k/tmpl1/src/__anonymous__"), line_number: Some(1), column_number: Some(1), eval_origin: None, is_top_level: None, is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: Some(1) }], formatted_frames: ["Object.assert ($deno$/util.ts:35:11)", "runtimeCompile ($deno$/compiler.ts:1534:3)", "tsCompilerOnMessage ($deno$/compiler.ts:1666:22)", "workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)", "file:///Users/schoward63/dev/k/tmpl1/src/__anonymous__:1:1"] })) to OpError', cli/op_error.rs:422:9

@alexanderGalushka
Copy link

alexanderGalushka commented Jul 14, 2020

@kitsonk I'm able to reproduce this, there are multiple tickets related to downcast ErrBox:

#6687
#6423

this has been reported and seems to be fixed, confirmed by @bartlomieju, could it be a regression related to TS version upgrade?

@bartlomieju
Copy link
Member

Thanks for minimal reproduction @sdhoward. @alexanderGalushka indeed there are multiple tickets with the same issue. I'll try to get it ASAP.

@bartlomieju bartlomieju self-assigned this Jul 14, 2020
@bartlomieju bartlomieju added bug Something isn't working correctly cli related to cli/ dir labels Jul 14, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Jul 14, 2020

@bartlomieju it is compiling .js without checkJs on that is the problem. So there is actually nothing to emit, which isn't actually unexpected. Clearly we shouldn't panic, but I am not 100% sure what the right response in this situation is. Maybe a throw in JS land? Something like:

Error: The compilation did not emit anything.  Are you sure your configuration is valid?

Also, maybe we turn checkJs: true by default on the compiler APIs?

@sdhoward in your particular case, you aren't telling the compiler to actually check JavaScript. I suspect if you did set the compiler option to checkJs: true you would get a more meaningful error as a work around for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants