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

CHECK failure in ResetStdio on >=12.5.0 #28479

Closed
devsnek opened this issue Jun 30, 2019 · 13 comments
Closed

CHECK failure in ResetStdio on >=12.5.0 #28479

devsnek opened this issue Jun 30, 2019 · 13 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. cli Issues and PRs related to the Node.js command line interface. confirmed-bug Issues with confirmed bugs.

Comments

@devsnek
Copy link
Member

devsnek commented Jun 30, 2019

Check failure is this: ../src/node.cc:649:void node::ResetStdio(): Assertion (err) != (-1)' failed.`

node/src/node.cc

Lines 646 to 649 in dec5b22

do
err = tcsetattr(fd, TCSANOW, &s.termios);
while (err == -1 && errno == EINTR); // NOLINT
CHECK_NE(err, -1);

Reproduction:

  1. Make sure you are on >=12.5.0
  2. clone https://github.com/engine262/engine262
  3. npm run build && npm run test
  4. Tests start running, hit ctrl+c to kill it
  5. Check failure happens consistently here
@devsnek devsnek changed the title CHECK failure in ResetStdio CHECK failure in ResetStdio on >=12.5.0 Jun 30, 2019
@CarterLi
Copy link

Same issue here

/usr/local/Cellar/node/12.5.0/bin/node[82501]: ../src/node.cc:649:void node::ResetStdio(): Assertion `(err) != (-1)' failed.
 1: 0x100078e78 node::Abort() [/usr/local/Cellar/node/12.5.0/bin/node]
 2: 0x100078c25 node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/usr/local/Cellar/node/12.5.0/bin/node]
 3: 0x1000571ef node::ResetStdio() [/usr/local/Cellar/node/12.5.0/bin/node]
 4: 0x7fff667413d6 __cxa_finalize_ranges [/usr/lib/system/libsystem_c.dylib]
 5: 0x7fff667416b3 exit [/usr/lib/system/libsystem_c.dylib]
 6: 0x10003a1ee node::Environment::stop_sub_worker_contexts() [/usr/local/Cellar/node/12.5.0/bin/node]
 7: 0x1001ccc58 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/Cellar/node/12.5.0/bin/node]
 8: 0x1001cc322 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(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/Cellar/node/12.5.0/bin/node]
 9: 0x1001cbb0a v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/Cellar/node/12.5.0/bin/node]
10: 0x10071a3b9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/Cellar/node/12.5.0/bin/node]

@rbatsenko
Copy link

Same here :/

/usr/local/bin/node[7611]: ../src/node.cc:649:void node::ResetStdio(): Assertion `(err) != (-1)' failed.
 1: 0x10007643b node::Abort() [/usr/local/bin/node]
 2: 0x1000761e3 node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/usr/local/bin/node]
 3: 0x1000541a9 node::ResetStdio() [/usr/local/bin/node]
 4: 0x7fff5dc153d6 __cxa_finalize_ranges [/usr/lib/system/libsystem_c.dylib]
 5: 0x7fff5dc156b3 exit [/usr/lib/system/libsystem_c.dylib]
 6: 0x100039326 node::Environment::stop_sub_worker_contexts() [/usr/local/bin/node]
 7: 0x1001f2214 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 8: 0x1001f1831 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(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]
 9: 0x1001f0ec0 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x10090d739 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
11: 0x1008829a4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
12: 0x10087bfdc Builtins_ArgumentsAdaptorTrampoline [/usr/local/bin/node]
13: 0x1008829a4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]

@devsnek devsnek added the confirmed-bug Issues with confirmed bugs. label Jun 30, 2019
@devsnek
Copy link
Member Author

devsnek commented Jun 30, 2019

cc @bnoordhuis it looks like this is from 5872705

@devsnek devsnek added cli Issues and PRs related to the Node.js command line interface. c++ Issues and PRs that require attention from people who are familiar with C++. labels Jun 30, 2019
@kahan002
Copy link

kahan002 commented Jun 30, 2019

Same issue with protractor testing (npm run e2e).
$ /usr/local/bin/node[1358]: ../src/node.cc:649:void node::ResetStdio(): Assertion `(err) != (-1)' failed.
1: 0x10007643b node::Abort() [/usr/local/bin/node]
2: 0x1000761e3 node::AppendExceptionLine(node::Environment*, v8::Localv8::Value, v8::Localv8::Message, node::ErrorHandlingMode) [/usr/local/bin/node]
3: 0x1000541a9 node::ResetStdio() [/usr/local/bin/node]
4: 0x7fff870ff451 __cxa_finalize_ranges [/usr/lib/system/libsystem_c.dylib]
5: 0x7fff870ff767 exit [/usr/lib/system/libsystem_c.dylib]
6: 0x7fff8511a5b4 start [/usr/lib/system/libdyld.dylib]

[On Mac OS X running protractor tests in terminal window of vs code]

@addaleax
Copy link
Member

addaleax commented Jul 1, 2019

@devsnek Are you on macOS? This doesn’t seem to happen with Linux, which makes it hard to debug for me. In any case, it might be good to know what errno is in that case.

Also, side note, another, different issue with the same commit was reported: #24260 (comment)

@devsnek
Copy link
Member Author

devsnek commented Jul 1, 2019

@addaleax i'm on arch linux. i'll compile it to print errno and report back

@devsnek
Copy link
Member Author

devsnek commented Jul 1, 2019

@addaleax

i found out, just doing npm run test is not enough, you have to spawn node with child_process and then ctrl+c it (i have a script runner i use that abstracts away npm, cargo, make, etc, which is why it reproduced for me originally)

require('child_process').spawn('node', ['test/test262.js'], {
  stdio: 'inherit',
});

output is:

errno 0
errno 2
errno 2
errno 0
errno 2
errno 2
errno 0
errno 2
errno 2
errno 2
errno 2
errno 2
errno 5
[11587]: ../src/node.cc:696:void node::ResetStdio(): Assertion `(err) != (-1)' failed.

from:

diff --git a/src/node.cc b/src/node.cc
index 9b4328d2ec..fb00ea023c 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -692,6 +692,7 @@ void ResetStdio() {
       do
         err = tcsetattr(fd, TCSANOW, &s.termios);
       while (err == -1 && errno == EINTR);  // NOLINT
+      printf("errno %d\n", errno);
       CHECK_NE(err, -1);
     }
   }

@bnoordhuis
Copy link
Member

Errno 5 is EIO. Basically the kernel is saying something went wrong without going into specifics, but I guess it's because the tty went away somehow. I'll open a PR to accept that error.

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jul 1, 2019
EIO has been observed to be returned by the Linux kernel under some
circumstances. Reading through drivers/tty/tty_io*.c, it seems to
indicate the tty went away. Of course none of this is documented.

Fixes: nodejs#28479
@bnoordhuis
Copy link
Member

#28490

@devsnek devsnek closed this as completed in 1095635 Jul 2, 2019
@devsnek
Copy link
Member Author

devsnek commented Jul 2, 2019

The fix will be available in the next node release

targos pushed a commit that referenced this issue Jul 2, 2019
EIO has been observed to be returned by the Linux kernel under some
circumstances. Reading through drivers/tty/tty_io*.c, it seems to
indicate the tty went away. Of course none of this is documented.

Fixes: #28479

PR-URL: #28490
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
targos pushed a commit that referenced this issue Jul 2, 2019
EIO has been observed to be returned by the Linux kernel under some
circumstances. Reading through drivers/tty/tty_io*.c, it seems to
indicate the tty went away. Of course none of this is documented.

Fixes: #28479

PR-URL: #28490
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jul 4, 2019
We might be a background job that doesn't own the TTY so block SIGTTOU
before making the tcsetattr() call, otherwise that signal suspends us.

This is a better fix than PR nodejs#28490 for issue nodejs#28479.

Fixes: nodejs#28530
Fixes: nodejs#28479
Refs: nodejs#28490
pull bot pushed a commit to Mattlk13/node that referenced this issue Jul 6, 2019
We might be a background job that doesn't own the TTY so block SIGTTOU
before making the tcsetattr() call, otherwise that signal suspends us.

This is a better fix than PR nodejs#28490 for issue nodejs#28479.

Fixes: nodejs#28530
Fixes: nodejs#28479
Refs: nodejs#28490

PR-URL: nodejs#28535
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
targos pushed a commit that referenced this issue Jul 20, 2019
We might be a background job that doesn't own the TTY so block SIGTTOU
before making the tcsetattr() call, otherwise that signal suspends us.

This is a better fix than PR #28490 for issue #28479.

Fixes: #28530
Fixes: #28479
Refs: #28490

PR-URL: #28535
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
@kahan002
Copy link

upgrading from node 12.5.0 to 12.16.3 fixed it.

@sinojelly
Copy link

sinojelly commented Jan 21, 2021

node 14.15.4 has this issue, I run it on Android Pad, Ubuntu over Termux.
/usr/bin/node[18408]: ../src/node.cc:699:void node::ResetStdio(): Assertion((*__errno_location ())) == (9)' failed.
Screenshot_20210122_063438_com termux

`

@mashirozx
Copy link

mashirozx commented Feb 4, 2021

node 14.15.4 has this issue, I run it on Android Pad, Ubuntu over Termux.
/usr/bin/node[18408]: ../src/node.cc:699:void node::ResetStdio(): Assertion((*__errno_location ())) == (9)' failed.
Screenshot_20210122_063438_com termux

`

same issue. node v14.15.4
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. cli Issues and PRs related to the Node.js command line interface. confirmed-bug Issues with confirmed bugs.
Projects
None yet
8 participants