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

Assertion failed ../deps/uv/src/unix/stream.c, line 1563 #8258

Closed
mhhf opened this issue Aug 24, 2016 · 11 comments
Closed

Assertion failed ../deps/uv/src/unix/stream.c, line 1563 #8258

mhhf opened this issue Aug 24, 2016 · 11 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. libuv Issues and PRs related to the libuv dependency or the uv binding.

Comments

@mhhf
Copy link

mhhf commented Aug 24, 2016

I cannot really provide reproducible code since this error happens in a non deterministically but here some details:

$ node app.js
Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1563.
$ uname -a
Darwin Deniss-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

Tested on node v6.4.0/ 6.3.1/ 6.2.2

$ lldb node app.js
(lldb) target create "node"
Current executable set to 'node' (x86_64).
(lldb) settings set -- target.run-args  "app.js"
(lldb) run
Process 68530 launched: '/usr/local/bin/node' (x86_64)

Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1563.
Process 68530 stopped
* thread #1: tid = 0x6c1407, 0x00007fff8d388f06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff8d388f06 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff8d388f06 <+10>: jae    0x7fff8d388f10            ; <+20>
    0x7fff8d388f08 <+12>: movq   %rax, %rdi
    0x7fff8d388f0b <+15>: jmp    0x7fff8d3837cd            ; cerror_nocancel
    0x7fff8d388f10 <+20>: retq
(lldb) bt
* thread #1: tid = 0x6c1407, 0x00007fff8d388f06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff8d388f06 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff8b08d4ec libsystem_pthread.dylib`pthread_kill + 90
    frame #2: 0x00007fff914cf6df libsystem_c.dylib`abort + 129
    frame #3: 0x00007fff91496dd8 libsystem_c.dylib`__assert_rtn + 321
    frame #4: 0x0000000100978b81 node`uv___stream_fd + 85
    frame #5: 0x0000000100977bba node`uv__stream_io + 1655
    frame #6: 0x000000010097f198 node`uv__io_poll + 1621
    frame #7: 0x0000000100970277 node`uv_run + 321
    frame #8: 0x00000001007e97ba node`node::Start(int, char**) + 642
    frame #9: 0x0000000100001034 node`start + 52
(lldb) bt all
* thread #1: tid = 0x6c1407, 0x00007fff8d388f06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff8d388f06 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff8b08d4ec libsystem_pthread.dylib`pthread_kill + 90
    frame #2: 0x00007fff914cf6df libsystem_c.dylib`abort + 129
    frame #3: 0x00007fff91496dd8 libsystem_c.dylib`__assert_rtn + 321
    frame #4: 0x0000000100978b81 node`uv___stream_fd + 85
    frame #5: 0x0000000100977bba node`uv__stream_io + 1655
    frame #6: 0x000000010097f198 node`uv__io_poll + 1621
    frame #7: 0x0000000100970277 node`uv_run + 321
    frame #8: 0x00000001007e97ba node`node::Start(int, char**) + 642
    frame #9: 0x0000000100001034 node`start + 52

  thread #2: tid = 0x6c141d, 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x000000010097a709 node`uv_sem_wait + 16
    frame #2: 0x00000001007ea17a node`node::DebugSignalThreadMain(void*) + 49
    frame #3: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #4: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #5: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #3: tid = 0x6c141e, 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'V8 WorkerThread'
    frame #0: 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00000001009828d7 node`v8::base::Semaphore::Wait() + 23
    frame #2: 0x00000001008484a9 node`v8::platform::TaskQueue::GetNext() + 57
    frame #3: 0x00000001008486ab node`v8::platform::WorkerThread::Run() + 43
    frame #4: 0x00000001009845d7 node`v8::base::ThreadEntry(void*) + 87
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #4: tid = 0x6c141f, 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'V8 WorkerThread'
    frame #0: 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00000001009828d7 node`v8::base::Semaphore::Wait() + 23
    frame #2: 0x00000001008484a9 node`v8::platform::TaskQueue::GetNext() + 57
    frame #3: 0x00000001008486ab node`v8::platform::WorkerThread::Run() + 43
    frame #4: 0x00000001009845d7 node`v8::base::ThreadEntry(void*) + 87
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #5: tid = 0x6c1420, 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'V8 WorkerThread'
    frame #0: 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00000001009828d7 node`v8::base::Semaphore::Wait() + 23
    frame #2: 0x00000001008484a9 node`v8::platform::TaskQueue::GetNext() + 57
    frame #3: 0x00000001008486ab node`v8::platform::WorkerThread::Run() + 43
    frame #4: 0x00000001009845d7 node`v8::base::ThreadEntry(void*) + 87
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #6: tid = 0x6c1421, 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'V8 WorkerThread'
    frame #0: 0x00007fff8d382fae libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x00000001009828d7 node`v8::base::Semaphore::Wait() + 23
    frame #2: 0x00000001008484a9 node`v8::platform::TaskQueue::GetNext() + 57
    frame #3: 0x00000001008486ab node`v8::platform::WorkerThread::Run() + 43
    frame #4: 0x00000001009845d7 node`v8::base::ThreadEntry(void*) + 87
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #7: tid = 0x6c1436, 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff8b08b728 libsystem_pthread.dylib`_pthread_cond_wait + 767
    frame #2: 0x000000010097a82b node`uv_cond_wait + 9
    frame #3: 0x000000010096e313 node`worker + 227
    frame #4: 0x000000010097a494 node`uv__thread_start + 25
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #8: tid = 0x6c1437, 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff8b08b728 libsystem_pthread.dylib`_pthread_cond_wait + 767
    frame #2: 0x000000010097a82b node`uv_cond_wait + 9
    frame #3: 0x000000010096e313 node`worker + 227
    frame #4: 0x000000010097a494 node`uv__thread_start + 25
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #9: tid = 0x6c1438, 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff8b08b728 libsystem_pthread.dylib`_pthread_cond_wait + 767
    frame #2: 0x000000010097a82b node`uv_cond_wait + 9
    frame #3: 0x000000010096e313 node`worker + 227
    frame #4: 0x000000010097a494 node`uv__thread_start + 25
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

  thread #10: tid = 0x6c1439, 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x00007fff8d388db6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff8b08b728 libsystem_pthread.dylib`_pthread_cond_wait + 767
    frame #2: 0x000000010097a82b node`uv_cond_wait + 9
    frame #3: 0x000000010096e313 node`worker + 227
    frame #4: 0x000000010097a494 node`uv__thread_start + 25
    frame #5: 0x00007fff8b08a99d libsystem_pthread.dylib`_pthread_body + 131
    frame #6: 0x00007fff8b08a91a libsystem_pthread.dylib`_pthread_start + 168
    frame #7: 0x00007fff8b088351 libsystem_pthread.dylib`thread_start + 13

On Linux machines the same code is causing the message "segmentation fault" (also not deterministically).

I'm using https://github.com/Level/leveldown package which might cause this error since it sometimes happens on reading/writing from the db, but also on totally unrelated function calls.
Also this error could be caused by other packages.

How to debug this further, since I have no Idea which package/ code-fragment is causing this.

@bnoordhuis
Copy link
Member

It sounds like memory corruption. Nine times out of ten it's caused by a wayward native module (e.g. leveldown) so try excluding those first. You can try running it under valgrind and see if it complains.

@mscdex mscdex added libuv Issues and PRs related to the libuv dependency or the uv binding. c++ Issues and PRs that require attention from people who are familiar with C++. labels Aug 24, 2016
@mhhf
Copy link
Author

mhhf commented Aug 25, 2016

valgrind gives me the following output, which i cannot really make sense of or infer the causing package:
(run.sh is just a wrapper around env variables and parameters)

$ valgrind --leak-check=yes ./run.sh
valgrind --leak-check=yes ./run.sh
==94144== Memcheck, a memory error detector
==94144== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==94144== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==94144== Command: ./run.sh
==94144==

Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1563.
./run.sh: line 2: 94145 Abort trap: 6           dapple script run B
==94144==
==94144== HEAP SUMMARY:
==94144==     in use at exit: 140,239 bytes in 672 blocks
==94144==   total heap usage: 829 allocs, 157 frees, 160,225 bytes allocated
==94144==
==94144== 231 bytes in 1 blocks are definitely lost in loss record 272 of 312
==94144==    at 0x1000A49FB: malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==94144==    by 0x1002B6AE1: currentlocale (in /usr/lib/system/libsystem_c.dylib)
==94144==    by 0x100029E7C: ??? (in /bin/sh)
==94144==    by 0x10000176F: ??? (in /bin/sh)
==94144==    by 0x1002265AC: start (in /usr/lib/system/libdyld.dylib)
==94144==    by 0x1: ???
==94144==    by 0x10489D9B2: ???
==94144==    by 0x10489D9BA: ???
==94144==
==94144== 2,064 bytes in 1 blocks are possibly lost in loss record 304 of 312
==94144==    at 0x1000A4CC4: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==94144==    by 0x1005D7EFD: _objc_copyClassNamesForImage (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB182: protocols() (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB093: readClass(objc_class*, bool, bool) (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005C8C13: gc_init (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005D024E: objc_initializeClassPair_internal(objc_class*, char const*, objc_class*, objc_class*) (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005DD132: layout_string_create (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB83C: realizeClass(objc_class*) (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB300: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB2E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB2E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib)
==94144==    by 0x1005CB2E9: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib)
==94144==
==94144== LEAK SUMMARY:
==94144==    definitely lost: 231 bytes in 1 blocks
==94144==    indirectly lost: 0 bytes in 0 blocks
==94144==      possibly lost: 2,064 bytes in 1 blocks
==94144==    still reachable: 117,662 bytes in 481 blocks
==94144==         suppressed: 20,282 bytes in 189 blocks
==94144== Reachable blocks (those to which a pointer was found) are not shown.
==94144== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==94144==
==94144== For counts of detected and suppressed errors, rerun with: -v
==94144== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 17 from 17)

@bnoordhuis
Copy link
Member

Run node directly under valgrind, you're tracing your shell now.

Maybe try it on Linux as well. Valgrind is sometimes hit-and-miss on OS X.

@mhhf
Copy link
Author

mhhf commented Aug 26, 2016

Ah! Here is the output on OS X:
A complete dump is here

Indeed leveldb is among the dump in the heap summery. Does this mean the problems are most likely caused by it?

valgrind --leak-check=yes node ~/nexus/dapple/cmd/main.js
==7286== Memcheck, a memory error detector
==7286== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7286== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==7286== Command: node /Users/mhhf/nexus/dapple/cmd/main.js
==7286==
==7286== Warning: set address range perms: large range [0x248d9ee24000, 0x248dbee24000) (noaccess)
==7286== Syscall param __pthread_sigmask(set) points to uninitialised byte(s)
==7286==    at 0x102EC1F36: __pthread_sigmask (in /usr/lib/system/libsystem_kernel.dylib)
==7286==    by 0x1030199B0: pthread_sigmask (in /usr/lib/system/libsystem_pthread.dylib)
==7286==    by 0x1009770AC: uv__signal_unlock_and_unblock (in /usr/local/bin/node)
==7286==    by 0x100976F7B: uv_signal_start (in /usr/local/bin/node)
==7286==    by 0x100813371: node::SignalWrap::Start(v8::FunctionCallbackInfo<v8::Value> const&) (in /usr/local/bin/node)
==7286==    by 0x100184E34: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) (in /usr/local/bin/node)
==7286==    by 0x1001CAEE8: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>) (in /usr/local/bin/node)
==7286==    by 0x1001DE446: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) (in /usr/local/bin/node)
==7286==    by 0x248D9F20961A: ???
==7286==    by 0x248D9F31F26D: ???
==7286==    by 0x248D9F31EDB2: ???
==7286==    by 0x248D9F31E801: ???
==7286==  Address 0x7fff5fbfd19c is on thread 1's stack
==7286==  in frame #3, created by uv_signal_start (???:)
==7286==
--7286-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option
--7286-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2 times)
--7286-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4 times)
==7286== Syscall param __pthread_sigmask(set) points to uninitialised byte(s)
==7286==    at 0x102EC1F36: __pthread_sigmask (in /usr/lib/system/libsystem_kernel.dylib)
==7286==    by 0x1030199B0: pthread_sigmask (in /usr/lib/system/libsystem_pthread.dylib)
==7286==    by 0x1009770AC: uv__signal_unlock_and_unblock (in /usr/local/bin/node)
==7286==    by 0x100976AA6: uv__signal_stop (in /usr/local/bin/node)
==7286==    by 0x1009770CB: uv_signal_stop (in /usr/local/bin/node)
==7286==    by 0x10096FEDF: uv_close (in /usr/local/bin/node)
==7286==    by 0x1007DD3CC: node::HandleWrap::Close(v8::FunctionCallbackInfo<v8::Value> const&) (in /usr/local/bin/node)
==7286==    by 0x100184E34: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) (in /usr/local/bin/node)
==7286==    by 0x1001CAEE8: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>) (in /usr/local/bin/node)
==7286==    by 0x1001DE446: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) (in /usr/local/bin/node)
==7286==    by 0x248D9F20961A: ???
==7286==    by 0x248DA0EC8B59: ???
==7286==  Address 0x7fff5fbf6c3c is on thread 1's stack
==7286==  in frame #3, created by uv__signal_stop (???:)
==7286==
--7286-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 8 times)
==7286== Invalid read of size 1
==7286==    at 0x100977A3D: uv__stream_io (in /usr/local/bin/node)
==7286==    by 0x10097F197: uv__io_poll (in /usr/local/bin/node)
==7286==    by 0x100970276: uv_run (in /usr/local/bin/node)
==7286==    by 0x1007E97B9: node::Start(int, char**) (in /usr/local/bin/node)
==7286==    by 0x100001033: (below main) (in /usr/local/bin/node)
==7286==  Address 0x103b519c9 is 729 bytes inside a block of size 800 free'd
==7286==    at 0x101BB5E3F: free (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7286==    by 0x1007A003C: v8::internal::CodePatcher::~CodePatcher() (in /usr/local/bin/node)
==7286==    by 0x10078653D: v8::internal::Code::PatchPlatformCodeAge(v8::internal::Isolate*, unsigned char*, v8::internal::Code::Age, v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x10058A3A4: v8::internal::Code::MakeOlder(v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x1004A75A9: v8::internal::StaticMarkingVisitor<v8::internal::IncrementalMarkingMarkingVisitor>::VisitCode(v8::internal::Map*, v8::internal::HeapObject*) (in /usr/local/bin/node)
==7286==    by 0x1004A5C83: v8::internal::IncrementalMarking::Step(long, v8::internal::IncrementalMarking::CompletionAction, v8::internal::IncrementalMarking::ForceMarkingAction, v8::internal::IncrementalMarking::ForceCompletionAction) (in /usr/local/bin/node)
==7286==    by 0x1004E607C: v8::internal::NewSpace::EnsureAllocation(int, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x10046221E: v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x100488C57: v8::internal::Heap::AllocateFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==    by 0x1004489BC: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==    by 0x10068E2BA: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) (in /usr/local/bin/node)
==7286==    by 0x248D9F206337: ???
==7286==  Block was alloc'd at
==7286==    at 0x101BB59FB: malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7286==    by 0x10014C17A: v8::internal::Malloced::New(unsigned long) (in /usr/local/bin/node)
==7286==    by 0x10075A7DD: v8::internal::Assembler::Assembler(v8::internal::Isolate*, void*, int) (in /usr/local/bin/node)
==7286==    by 0x10079FF1A: v8::internal::CodePatcher::CodePatcher(v8::internal::Isolate*, unsigned char*, int) (in /usr/local/bin/node)
==7286==    by 0x100786515: v8::internal::Code::PatchPlatformCodeAge(v8::internal::Isolate*, unsigned char*, v8::internal::Code::Age, v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x10058A3A4: v8::internal::Code::MakeOlder(v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x1004A75A9: v8::internal::StaticMarkingVisitor<v8::internal::IncrementalMarkingMarkingVisitor>::VisitCode(v8::internal::Map*, v8::internal::HeapObject*) (in /usr/local/bin/node)
==7286==    by 0x1004A5C83: v8::internal::IncrementalMarking::Step(long, v8::internal::IncrementalMarking::CompletionAction, v8::internal::IncrementalMarking::ForceMarkingAction, v8::internal::IncrementalMarking::ForceCompletionAction) (in /usr/local/bin/node)
==7286==    by 0x1004E607C: v8::internal::NewSpace::EnsureAllocation(int, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x10046221E: v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x100488C57: v8::internal::Heap::AllocateFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==    by 0x1004489BC: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==
==7286== Invalid read of size 4
==7286==    at 0x100978B30: uv___stream_fd (in /usr/local/bin/node)
==7286==    by 0x100977BB9: uv__stream_io (in /usr/local/bin/node)
==7286==    by 0x10097F197: uv__io_poll (in /usr/local/bin/node)
==7286==    by 0x100970276: uv_run (in /usr/local/bin/node)
==7286==    by 0x1007E97B9: node::Start(int, char**) (in /usr/local/bin/node)
==7286==    by 0x100001033: (below main) (in /usr/local/bin/node)
==7286==  Address 0x103b51980 is 656 bytes inside a block of size 800 free'd
==7286==    at 0x101BB5E3F: free (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7286==    by 0x1007A003C: v8::internal::CodePatcher::~CodePatcher() (in /usr/local/bin/node)
==7286==    by 0x10078653D: v8::internal::Code::PatchPlatformCodeAge(v8::internal::Isolate*, unsigned char*, v8::internal::Code::Age, v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x10058A3A4: v8::internal::Code::MakeOlder(v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x1004A75A9: v8::internal::StaticMarkingVisitor<v8::internal::IncrementalMarkingMarkingVisitor>::VisitCode(v8::internal::Map*, v8::internal::HeapObject*) (in /usr/local/bin/node)
==7286==    by 0x1004A5C83: v8::internal::IncrementalMarking::Step(long, v8::internal::IncrementalMarking::CompletionAction, v8::internal::IncrementalMarking::ForceMarkingAction, v8::internal::IncrementalMarking::ForceCompletionAction) (in /usr/local/bin/node)
==7286==    by 0x1004E607C: v8::internal::NewSpace::EnsureAllocation(int, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x10046221E: v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x100488C57: v8::internal::Heap::AllocateFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==    by 0x1004489BC: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==    by 0x10068E2BA: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) (in /usr/local/bin/node)
==7286==    by 0x248D9F206337: ???
==7286==  Block was alloc'd at
==7286==    at 0x101BB59FB: malloc (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7286==    by 0x10014C17A: v8::internal::Malloced::New(unsigned long) (in /usr/local/bin/node)
==7286==    by 0x10075A7DD: v8::internal::Assembler::Assembler(v8::internal::Isolate*, void*, int) (in /usr/local/bin/node)
==7286==    by 0x10079FF1A: v8::internal::CodePatcher::CodePatcher(v8::internal::Isolate*, unsigned char*, int) (in /usr/local/bin/node)
==7286==    by 0x100786515: v8::internal::Code::PatchPlatformCodeAge(v8::internal::Isolate*, unsigned char*, v8::internal::Code::Age, v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x10058A3A4: v8::internal::Code::MakeOlder(v8::internal::MarkingParity) (in /usr/local/bin/node)
==7286==    by 0x1004A75A9: v8::internal::StaticMarkingVisitor<v8::internal::IncrementalMarkingMarkingVisitor>::VisitCode(v8::internal::Map*, v8::internal::HeapObject*) (in /usr/local/bin/node)
==7286==    by 0x1004A5C83: v8::internal::IncrementalMarking::Step(long, v8::internal::IncrementalMarking::CompletionAction, v8::internal::IncrementalMarking::ForceMarkingAction, v8::internal::IncrementalMarking::ForceCompletionAction) (in /usr/local/bin/node)
==7286==    by 0x1004E607C: v8::internal::NewSpace::EnsureAllocation(int, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x10046221E: v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) (in /usr/local/bin/node)
==7286==    by 0x100488C57: v8::internal::Heap::AllocateFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==    by 0x1004489BC: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) (in /usr/local/bin/node)
==7286==
Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1563.
==7286==
==7286== Process terminating with default action of signal 6 (SIGABRT)
==7286==    at 0x102EC1F36: __pthread_sigmask (in /usr/lib/system/libsystem_kernel.dylib)
==7286==    by 0x102DD076C: __abort (in /usr/lib/system/libsystem_c.dylib)
==7286==    by 0x102DD06ED: abort (in /usr/lib/system/libsystem_c.dylib)
==7286==    by 0x102D97DD7: __assert_rtn (in /usr/lib/system/libsystem_c.dylib)
==7286==    by 0x100978B80: uv___stream_fd (in /usr/local/bin/node)
==7286==    by 0x100977BB9: uv__stream_io (in /usr/local/bin/node)
==7286==    by 0x10097F197: uv__io_poll (in /usr/local/bin/node)
==7286==    by 0x100970276: uv_run (in /usr/local/bin/node)
==7286==    by 0x1007E97B9: node::Start(int, char**) (in /usr/local/bin/node)
==7286==    by 0x100001033: (below main) (in /usr/local/bin/node)
==7286==
==7286== HEAP SUMMARY:
==7286==     in use at exit: 127,419,314 bytes in 4,679 blocks
==7286==   total heap usage: 859,668 allocs, 854,989 frees, 6,233,477,728 bytes allocated
==7286==
[...]

@bnoordhuis
Copy link
Member

The leveldb entries are memory leaks, which makes sense - the program is terminated so leveldb doesn't get a chance to clean up. Still, it would be good to exclude it just to see if the problem goes away.

Are you using the homebrew build by any chance? Someone reported a similar issue yesterday that went away when they switched to the official binaries from https://nodejs.org/.

@Trott
Copy link
Member

Trott commented Jul 10, 2017

This issue has been inactive for sufficiently long that it seems like perhaps it should be closed. Feel free to re-open (or leave a comment requesting that it be re-opened) if you disagree. I'm just tidying up and not acting on a super-strong opinion or anything like that.

@xumix
Copy link

xumix commented Oct 14, 2019

@Trott having this issue in Connormiha/jest-css-modules-transform#14

@bnoordhuis
Copy link
Member

@xumix If you can reproduce with a supported version of Node.js and your script doesn't use native modules, then please open a new issue and include steps to reproduce. The more minimal the test case, the better.

@OmgImAlexis
Copy link

Randomly just hit this or something similar myself. Using node v14.13.0 and npm v6.14.8 on macOS 10.15.7 (19H2).

Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1622.
[1]    47500 abort      DEBUG=true PORT=9000 ./node_modules/.bin/qq ./src/schemas

@kirrg001
Copy link

kirrg001 commented Mar 12, 2024

I was running into this today quite often. I updated my OSX software yesterday and the developer tools as well.
Since then this problem occurs.

NVM Node v18.14
OSX 14.2.1 (23C71)

@valbaca
Copy link

valbaca commented Oct 11, 2024

I'd also had the same error, across multiple node versions from v18 to v22

Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file stream.c, line 1558.
 ›   Error: Failed to run application build system.

The fix for me was: brew uninstall watchman

I'd installed watchman when working on a different project, but for some reason jest --runInBand would throw the uv___stream_fd Assertion failed. Uninstalling watchman altogether fixed the issue for me.

An alternative would've been to just not use the --runInBand flag with jest, but that wasn't an option for me.

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++. libuv Issues and PRs related to the libuv dependency or the uv binding.
Projects
None yet
Development

No branches or pull requests

8 participants