nodejs-system-sleep icon indicating copy to clipboard operation
nodejs-system-sleep copied to clipboard

After using sleep() in my project I am seeing the following error

Open tinder-ubhatnagar opened this issue 8 years ago • 5 comments

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 1567.
Abort trap: 6

Looks like something related to deasync

tinder-ubhatnagar avatar Mar 21 '17 07:03 tinder-ubhatnagar

+1 for that. macOS Sierra

rozhok avatar May 11 '17 11:05 rozhok

@tinder-ubhatnagar and @rozhok Today you described that the deasync module throws an exception on a Mac platform. I have updated the module to call deasync in a try block so that we can safely fall back on the execution of an idle child process and pretend to be asleep if for some reason deasync is not installed or functioning properly.

The current version is now: 1.3.5. Let me know if you experience any problems. Please download the latest release from GitHub or NPM install system-sleep

jochemstoel avatar May 12 '17 02:05 jochemstoel

Hi, I'm still experiencing this problem on Express 4.15 & Node 8.6.0 on macOS High Sierra. I'm using system-sleep 1.3.6

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 1619.

UPDATE Oct 2017:


Okay on Node 6.10 but error on Node 8.6.0

**UPDATE** (31 Oct 2017 maybe. I don't know) (I'm updating this from Apr 10, 2018)**:**

I couldn't remember and solve what caused the native error on 2017 ago, it's from deasync.

I finally switched to sleep-promise and using `yield sleep(2000)` inside a `co.wrap`ped generator function just fine.  
I did that because it's Node 6 (or is it the earliest version of Node 8? I don't know I can't remember) and I didn't use TypeScript.

Summary:

- Use sleep-promise instead of this package
- Then:
  - `await` the sleep-promise; or
  - If your Node doesn't support use async/await, use TypeScript; or
  - If you really can't use both async/await and TypeScript, take a look at generator functions (`function*(){}`), `yield`, and `co.wrap` or other alternatives.

luthfianto avatar Oct 12 '17 14:10 luthfianto

both 1.3.5 and 1.3.6 versions crashed running on node 8.11.1 macOS high sierra. it's working fine in windows server 2008/window 10

karyeun avatar Apr 10 '18 15:04 karyeun

Running a project using system-sleep version 1.3.6 on node 11 (Mac OSX Mojave), I get the following error:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: 0x10003a5ab node::Abort() [/usr/local/bin/node]
 2: 0x10003a77c node::FatalTryCatch::~FatalTryCatch() [/usr/local/bin/node]
 3: 0x10016f2c2 v8::Utils::ReportApiFailure(char const*, char const*) [/usr/local/bin/node]
 4: 0x100026b1a node::Environment::CheckImmediate(uv_check_s*) [/usr/local/bin/node]
 5: 0x100760f5c uv__run_check [/usr/local/bin/node]
 6: 0x10075c42d uv_run [/usr/local/bin/node]
 7: 0x101ffc9d0 Run(Nan::FunctionCallbackInfo<v8::Value> const&) [/Users/lfoppiano/development/scienceminer/istex/biblio-glutton/matching/node_modules/deasync/bin/darwin-x64-node-11/deasync.node]
 8: 0x101ffccf5 Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/lfoppiano/development/scienceminer/istex/biblio-glutton/matching/node_modules/deasync/bin/darwin-x64-node-11/deasync.node]
 9: 0x1001d2524 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/usr/local/bin/node]
10: 0x1001d1b6a 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]
11: 0x1001d136d v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0xb09ea5cfb7d 
13: 0xb09ea58e458 
Abort trap: 6

If I drop the dependency and remove the calls the error disappear.

lfoppiano avatar Oct 31 '18 09:10 lfoppiano