Node: CHECK failure in ResetStdio on >=12.5.0

Created on 30 Jun 2019  路  11Comments  路  Source: nodejs/node

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

https://github.com/nodejs/node/blob/dec5b2258a853b524e125542667b5b2dfc5afb74/src/node.cc#L646-L649

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
C++ cli confirmed-bug

Most helpful comment

The fix will be available in the next node release

All 11 comments

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]

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]

cc @bnoordhuis it looks like this is from 5872705796d

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::Local, v8::Local, 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]

@devsnek Are you on macOS? This doesn鈥檛 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: https://github.com/nodejs/node/pull/24260#issuecomment-506922414

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

@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);
     }
   }

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.

28490

The fix will be available in the next node release

upgrading from node 12.5.0 to 12.16.3 fixed it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielstaleiny picture danielstaleiny  路  3Comments

sandeepks1 picture sandeepks1  路  3Comments

srl295 picture srl295  路  3Comments

addaleax picture addaleax  路  3Comments

stevenvachon picture stevenvachon  路  3Comments