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

node: ../deps/uv/src/unix/core.c:544: uv__close_nocheckstdio: Assertion `fd > -1' failed. #2099

Closed
gwmai opened this issue Aug 5, 2019 · 12 comments

Comments

@gwmai
Copy link

gwmai commented Aug 5, 2019

  • Node.js Version:v12.3.1
  • OS: Ubuntu 18.0.4
  • Scope (install, code, runtime, meta, other?): Trying to install packages
  • Module (and version) (if relevant): Any module

I'm trying to use npm install @symfony/webpack-encore and I'm getting the following error

This works OK when I run as root but when doing from a chrooted user it yields this error. Probably some library is missing in the chroot environment but I'm unable to deduce from the error message.

node: ../deps/uv/src/unix/core.c:544: uv__close_nocheckstdio: Assertion `fd > -1' failed.
Aborted (core dumped)
@addaleax
Copy link
Member

addaleax commented Aug 5, 2019

Can you share a core dump, and/or try to use the latest version of Node 12 and see if it still reproduces?

@ioweb-gr
Copy link

ioweb-gr commented Aug 5, 2019

Same thing on 12.7 version. How would I take a core dump in chroot environment?

@ioweb-gr
Copy link

ioweb-gr commented Aug 5, 2019

After thorough debugging this error came from missing /sys/fs/cgroup/memory/memory.limit_in_bytes and /proc/meminfo files in chroot environment.

@addaleax
Copy link
Member

addaleax commented Aug 5, 2019

@nodejs/libuv @kjin

@bnoordhuis
Copy link
Member

I believe libuv/libuv#2323 addresses this.

@kjin
Copy link

kjin commented Aug 8, 2019

I'm still looking into it, but I should note that my change(s) do not have to do with reading /proc/meminfo, and currently I can't see a code path that would lead to fd failing the assertion check. Not to say that this isn't because of the cgroups change, but because uv_get_total_memory has existed before the cgroups change, I'm curious as to whether this was failing before v12.3.1 (right now, to me, it would be strange if it didn't).

@ioweb-gr
Copy link

ioweb-gr commented Aug 8, 2019

I have two servers running debian 8 and 9 with node 10.x and 11.x and I didn't face this issue. In ubuntu however all node versions from 10+ threw this error

nono added a commit to cozy/cozy-stack that referenced this issue Aug 29, 2019
With node 12, the konnectors need a read access to /proc to not crash.

See nodejs/help#2099 for example.
@vitlav
Copy link

vitlav commented Jan 21, 2020

$ node
node: src/unix/core.c:556: uv__close_nocheckstdio: Assertion `fd > -1' failed.
Aborted
$ node -v
v13.6.0

strace:

[pid 1276004] openat(AT_FDCWD, "/sys/fs/cgroup/memory/memory.limit_in_bytes", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1276004] openat(AT_FDCWD, "/proc/meminfo", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1276004] read(-2, 0x7fffdd4b45a0, 4095) = -1 EBADF (Bad file descriptor)
[pid 1276004] write(2, "node: src/unix/core.c:556: uv__c"..., 79node: src/unix/core.c:556: uv__close_nocheckstdio: Assertion `fd > -1' failed.

@vitlav
Copy link

vitlav commented Jan 21, 2020

It is libuv issue in uv_get_total_memory (checked with libuv 1.34.0):

#3  0x00007ffff71810a2 in __GI___assert_fail (assertion=assertion@entry=0x7ffff7f9f8fd "fd > -1", file=file@entry=0x7ffff7f9f8d5 "src/unix/core.c", line=line@entry=556, 
    function=function@entry=0x7ffff7f9fb50 <__PRETTY_FUNCTION__.10400> "uv__close_nocheckstdio") at assert.c:101
#4  0x00007ffff7f8b8f3 in uv__close_nocheckstdio (fd=-2) at src/unix/core.c:556
#5  uv__close_nocheckstdio (fd=fd@entry=-2) at src/unix/core.c:552
#6  0x00007ffff7f9abc1 in uv__read_proc_meminfo (what=0x7ffff7fa0e54 "MemTotal:") at src/unix/linux-core.c:1006
#7  0x00007ffff7f9c012 in uv_get_total_memory () at src/unix/linux-core.c:1033
#8  0x0000000000a0d355 in node::SetIsolateCreateParamsForNode (params=params@entry=0x7fffffffe430) at ../src/api/environment.cc:191

addaleax added a commit to addaleax/libuv that referenced this issue Jan 21, 2020
`uv__open_cloexec()` already returns a libuv error code in case
of failure, and not `-1` like syscalls do.

Fixes: nodejs/help#2099
@addaleax
Copy link
Member

@vitlav Thanks, that’s very helpful. libuv/libuv#2645 should address this 👍

@vitlav
Copy link

vitlav commented Jan 21, 2020

@vitlav Thanks, that’s very helpful. libuv/libuv#2645 should address this
Thank you very much! node works with this fix ever if /proc is missed.

vt-alt pushed a commit to altlinux/specs that referenced this issue Jan 21, 2020
- new version 1.34.1 (with rpmrb script)
- drop python-devel and gyp from buildreqs
- fix node fail if /proc is not mounted (nodejs/help#2099)
@apusg
Copy link

apusg commented Jan 21, 2020

In which release will this change be included?

cjihrig added a commit to cjihrig/node that referenced this issue Jan 23, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs#31328
Fixes: nodejs/help#2099
Trott pushed a commit to Trott/io.js that referenced this issue Jan 25, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs#31328
Fixes: nodejs/help#2099

PR-URL: nodejs#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this issue Feb 17, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: #31328
Fixes: nodejs/help#2099

PR-URL: #31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs pushed a commit to BethGriggs/node that referenced this issue Feb 26, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs#31328
Fixes: nodejs/help#2099

PR-URL: nodejs#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs pushed a commit to nodejs/node that referenced this issue Mar 2, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: #31328
Fixes: nodejs/help#2099

PR-URL: #31477
Backport-PR-URL: #31969
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this issue Mar 15, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: #31328
Fixes: nodejs/help#2099

PR-URL: #31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this issue Mar 17, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: #31328
Fixes: nodejs/help#2099

PR-URL: #31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
zcbenz pushed a commit to yue/node that referenced this issue Apr 3, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs/node#31328
Fixes: nodejs/help#2099

PR-URL: nodejs/node#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
zcbenz pushed a commit to yue/node that referenced this issue Apr 3, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs/node#31328
Fixes: nodejs/help#2099

PR-URL: nodejs/node#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
zcbenz pushed a commit to yue/node that referenced this issue Apr 3, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs/node#31328
Fixes: nodejs/help#2099

PR-URL: nodejs/node#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
zcbenz pushed a commit to yue/node that referenced this issue Apr 3, 2020
Notable changes:

- SetApplicationDaemon() is no longer called on macOS.
- uv_interface_addresses() is implemented on IBMi.
- The return value of uv__open_cloexec() is now handled
  properly.
- A race condition in fsevents has been fixed.

Fixes: nodejs/node#31328
Fixes: nodejs/help#2099

PR-URL: nodejs/node#31477
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
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
None yet
Projects
None yet
7 participants