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

better error message for wasi #30878

Closed
gengjiawen opened this issue Dec 10, 2019 · 1 comment · Fixed by #31076
Closed

better error message for wasi #30878

gengjiawen opened this issue Dec 10, 2019 · 1 comment · Fixed by #31076
Labels
confirmed-bug Issues with confirmed bugs. wasi Issues and PRs related to the WebAssembly System Interface. wasm Issues and PRs related to WebAssembly.

Comments

@gengjiawen
Copy link
Member

when preopens directory not really exists, Node.js failed with

node[55811]: ../src/node_wasi.cc:88:node::wasi::WASI::WASI(node::Environment *, Local<v8::Object>, uvwasi_options_t *): Assertion `(uvwasi_init(&uvw_, options)) == (0)' failed.
 1: 0x100081683 node::Abort() [/usr/local/bin/node]
 2: 0x10008142b node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/usr/local/bin/node]
 3: 0x1000e58be node::wasi::WASI::WASI(node::Environment*, v8::Local<v8::Object>, uvwasi_options_s*) [/usr/local/bin/node]
 4: 0x1000e5e5b node::wasi::WASI::New(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 5: 0x1001ec8d0 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 6: 0x1001ebb9d v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 7: 0x1001eb557 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 8: 0x100951939 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
fish: 'node --experimental-wasi-unstab…' terminated by signal SIGABRT (Abort)

Repro code:

"use strict";
const fs = require('fs');
const { WASI } = require('wasi');
const wasi = new WASI({
    args: process.argv,
    env: process.env,
    preopens: {
        '/sandbox': '/not/real/path'
    }
})

I think maybe we can add some pre-check here ? The current error message doesn't provide much information.

cc @nodejs/wasi

@gengjiawen gengjiawen added the wasm Issues and PRs related to WebAssembly. label Dec 10, 2019
@cjihrig
Copy link
Contributor

cjihrig commented Dec 10, 2019

Thanks for reporting. I'll send a fix.

@legendecas legendecas added the wasi Issues and PRs related to the WebAssembly System Interface. label Dec 11, 2019
@BridgeAR BridgeAR added the confirmed-bug Issues with confirmed bugs. label Dec 20, 2019
BridgeAR pushed a commit that referenced this issue Jan 3, 2020
Prior to this commit, if uvwasi_init() failed in any way, Node
would abort due to a failed CHECK_EQ(). This commit changes
that behavior to a thrown exception.

PR-URL: #31076
Fixes: #30878
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this issue Jan 14, 2020
Prior to this commit, if uvwasi_init() failed in any way, Node
would abort due to a failed CHECK_EQ(). This commit changes
that behavior to a thrown exception.

PR-URL: #31076
Fixes: #30878
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this issue Jan 14, 2020
Prior to this commit, if uvwasi_init() failed in any way, Node
would abort due to a failed CHECK_EQ(). This commit changes
that behavior to a thrown exception.

PR-URL: #31076
Fixes: #30878
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs pushed a commit that referenced this issue Feb 6, 2020
Prior to this commit, if uvwasi_init() failed in any way, Node
would abort due to a failed CHECK_EQ(). This commit changes
that behavior to a thrown exception.

PR-URL: #31076
Fixes: #30878
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. wasi Issues and PRs related to the WebAssembly System Interface. wasm Issues and PRs related to WebAssembly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants