-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
fs.access
causes abort() when run in Emacs shell
#6563
Comments
According to the stack trace, the problem is that libuv can't spawn threads for its thread pool. Perhaps emacs sets |
Unfortunately it still crashes. I have tried with Emacs's var fs = require('fs');
fs.access('/usr/local/bin/node', fs.X_OK, function (er) {
console.log('this never prints out');
}); removing the |
Also, |
If the stack trace is still the same, then emacs must be doing something that prevents node/libuv from operating normally. I could make libuv print a nicer error message or trudge on in single-thread mode but that's a workaround more than anything else (and it met with some opposition from other maintainers last time I proposed it.) |
When running v6.0.0 in emacs 24.5.1 (the most current version from Homebrew on OS X), I face a similar situation. Running any node command from a terminal or shell bash session within emacs, even just running Outside of emacs with v.6.0.0, everything is cool. Inside emacs with with v.5.9.1, everything is cool. |
I wonder if it's because of 204f3a8 where we bumped MACOSX_DEPLOYMENT_TARGET from 10.5 to 10.7. What happens when you revert that commit and rebuild? |
Reporting the same problem! |
Confirmed on v6+ for me. https://github.com/libuv/libuv/blob/v1.x/src/unix/thread.c#L86 is returning |
Maybe same problem. |
@evanlucas Errno 22 is EINVAL. Is it possible that |
On my system, that is the case. |
Okay, that explains it. Does this patch fix it? diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c
index c35bc92..56bb8a4 100644
--- a/deps/uv/src/unix/thread.c
+++ b/deps/uv/src/unix/thread.c
@@ -28,6 +28,7 @@
#include <sys/time.h>
#include <sys/resource.h> /* getrlimit() */
+#include <unistd.h> /* getpagesize() */
#include <limits.h>
@@ -82,10 +83,13 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
if (pthread_attr_init(attr))
abort();
- if (lim.rlim_cur != RLIM_INFINITY &&
- lim.rlim_cur >= PTHREAD_STACK_MIN) {
- if (pthread_attr_setstacksize(attr, lim.rlim_cur))
- abort();
+ if (lim.rlim_cur != RLIM_INFINITY) {
+ /* pthread_attr_setstacksize() expects page-aligned values. */
+ lim.rlim_cur -= lim.rlim_cur % (rlim_t) getpagesize();
+
+ if (lim.rlim_cur >= PTHREAD_STACK_MIN)
+ if (pthread_attr_setstacksize(attr, lim.rlim_cur))
+ abort();
}
#else
attr = NULL; |
@bnoordhuis I'm thinking that libuv/libuv@3db07cc is what is exposing this issue. Pulling that out fixes it |
ah didn't see your comment when I posted @bnoordhuis. Confirmed that applying this patch fixes the issue for me. Yay!!! |
pthread_attr_setstacksize() expects that the stack size is a multiple of the page size so make sure that it is. Fixes a regression introduced in commit 3db07cc ("osx: set the default thread stack size to RLIMIT_STACK") that made the program abort under certain configurations; GNU Emacs on OS X apparently sets RLIMIT_STACK to odd values when executing child processes. Fixes: nodejs/node#6563
Good to hear. Libuv PR: libuv/libuv#864 |
pthread_attr_setstacksize() expects that the stack size is a multiple of the page size so make sure that it is. Fixes a regression introduced in commit 3db07cc ("osx: set the default thread stack size to RLIMIT_STACK") that made the program abort under certain configurations; GNU Emacs on OS X apparently sets RLIMIT_STACK to odd values when executing child processes. Fixes: nodejs/node#6563 PR-URL: libuv#864 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fixes: nodejs#4002 Fixes: nodejs#5384 Fixes: nodejs#6563 Refs: nodejs#2680 (comment) PR-URL: nodejs#6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: #4002 Fixes: #5384 Fixes: #6563 Refs: #2680 (comment) PR-URL: #6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: nodejs#4002 Fixes: nodejs#5384 Fixes: nodejs#6563 Refs: nodejs#2680 (comment) PR-URL: nodejs#6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: #4002 Fixes: #5384 Fixes: #6563 Refs: #2680 (comment) PR-URL: #6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: #4002 Fixes: #5384 Fixes: #6563 Refs: #2680 (comment) PR-URL: #6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: #4002 Fixes: #5384 Fixes: #6563 Refs: #2680 (comment) PR-URL: #6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: #4002 Fixes: #5384 Fixes: #6563 Refs: #2680 (comment) PR-URL: #6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Fixes: #4002 Fixes: #5384 Fixes: #6563 Refs: #2680 (comment) PR-URL: #6796 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Myles Borins <myles.borins@gmail.com>
pthread_attr_setstacksize() expects that the stack size is a multiple of the page size so make sure that it is. Fixes a regression introduced in commit 3db07cc ("osx: set the default thread stack size to RLIMIT_STACK") that made the program abort under certain configurations; GNU Emacs on OS X apparently sets RLIMIT_STACK to odd values when executing child processes. Fixes: nodejs/node#6563 PR-URL: libuv#864 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
pthread_attr_setstacksize() expects that the stack size is a multiple of the page size so make sure that it is. Fixes a regression introduced in commit 3db07cc ("osx: set the default thread stack size to RLIMIT_STACK") that made the program abort under certain configurations; GNU Emacs on OS X apparently sets RLIMIT_STACK to odd values when executing child processes. Fixes: nodejs/node#6563 PR-URL: libuv/libuv#864 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> (cherry picked from commit 28d160f)
Darwin steph-mbp 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
After upgrading 6.0, I can't run
npm
in an Emacs subshell because it crashes on any call tofs.access
; I'm aware this might be Emacs-specific (works fine in iTerm + ZSH) but in the slim case this is an actual regression I'm attaching the full stacktrace from my system.node_2016-05-04-104139_Stephanes-MacBook-Pro.crash.txt
The text was updated successfully, but these errors were encountered: