-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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 aborts when logging to stdout in JS called from C++ #3422
Comments
/cc @indutny |
Can't reproduce it on OS X. Going to build it on linux. |
@mscdex I get different assertion in binding when running it in Debug mode:
Could it be that the binding is faulty by itself? |
Yeah, it seems to be passing bad fd for me:
This is where |
@indutny Right, that may be the original bug I was trying to find, but I am still getting the other backtrace. I cannot for the life of me get the backtrace you are seeing.. :-( I tried both v4.2.1 and master. FWIW it's on Ubuntu 14.10. |
@mscdex may I ask you to try bisecting node to find the commit that may have caused it? |
Ok, git bisect is pointing to 1d0e5210a, which is when libuv was updated from 1.6.1 to 1.7.3. |
cc @saghul |
Bisected the libuv upgrade and it looks like libuv/libuv@60fca01705 is the breaking commit there. |
I'd start with the assumption that this is a node.js bug that gets flushed out by a libuv change. |
Most likely this is the case, @bnoordhuis . @mscdex what happens if you will run it like this |
@indutny I'm not seeing that in the valgrind output. |
Am I right this patch hits the CHECK? diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index a78d231..84d3608 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -134,7 +134,7 @@ TTYWrap::TTYWrap(Environment* env, Local<Object> object, int fd, bool readable)
object,
reinterpret_cast<uv_stream_t*>(&handle_),
AsyncWrap::PROVIDER_TTYWRAP) {
- uv_tty_init(env->event_loop(), &handle_, fd, readable);
+ CHECK_EQ(0, uv_tty_init(env->event_loop(), &handle_, fd, readable));
}
} // namespace node |
@bnoordhuis It's passing the check. I added a debug statement and |
@mscdex are you sure about libuv/libuv@60fca01705 ? |
@indutny Pretty sure, yes. If I check out at the parent commit no abort happens. |
@mscdex just to make sure I understand it correctly, you are reverting just that change in |
@indutny Yes. With libuv/libuv@60fca01 it aborts. With the parent commit libuv/libuv@c1fe25f654 it doesn't abort. |
@mscdex may I ask you to reproduce it on debug build of node? If it will still crash, may I ask you to print:
|
I believe fd 9 is the socket fd for the database connection. |
@mscdex ok, now it is time for a serious action :) Let's add: if (this !== process.stdout && this !== process.stderr) console.trace(); Before https://github.com/nodejs/node/blob/master/lib/net.js#L644 |
Nothing new is displayed with that change. |
Ok, this is bad :( |
Let's add |
With that added I get:
Line 404 in Client.js is just where I |
Hm... this is very very strange. It looks like the |
I see no other choice, but to you memory breakpoints in gdb. Hope you don't mind helping me (sorry for lots of instructions):
Thanks! |
As discussed on IRC, it does seem to be a mariadb binding bug, not a node.js/libuv bug . @mscdex feel free to reopen the issue if it will turn out to be something else. |
This is a weird one and I haven't yet found a simpler way to reproduce it, but it does reproduce every time. This does require a mysql/mariadb server though.
This is happening on Linux.
Steps:
npm install https://github.com/mscdex/node-mariasql/tarball/0cff1a10fc
bug.js
) and execute it (node bug.js
):Output:
Backtrace:
I should also note that the abort doesn't happen when the problematic code is ran either in the REPL or via
node -pe "..."
.The text was updated successfully, but these errors were encountered: