Skip to content

Conversation

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented May 13, 2016

Print a C backtrace on fatal errors to make it easier to debug issues
like #6727.

CI: https://ci.nodejs.org/job/node-test-pull-request/2629/

@bnoordhuis bnoordhuis added the lib / src Issues and PRs related to general changes in the lib or src directory. label May 13, 2016
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 13, 2016
src/backtrace.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include "src/base/logging.h" works too, at least locally for me. Any particular reason for including the source file itself?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And CI is failing on smartos with ld: fatal: symbol 'v8::base::DumpBacktrace()' is multiply-defined: https://ci.nodejs.org/job/node-test-commit-smartos/2478/nodes=smartos14-32/console

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included the .cc so it works with shared V8 builds (think Fedora, Debian, Ubuntu, etc.,or linking against a .so.)

I'll ifdef out smartos. That user base is a rounding error compared to the aforementioned distros.

@bnoordhuis
Copy link
Member Author

@addaleax
Copy link
Member

LGTM if CI is green

@Fishrock123
Copy link
Contributor

Oh my gosh, +1000

@Fishrock123
Copy link
Contributor

Looks like plinux doesn't like it.

In file included from ../deps/v8/src/base/logging.h:12:0,
                 from ../deps/v8/src/base/logging.cc:5,
                 from ../src/backtrace.cc:7:
../deps/v8/src/base/build_config.h:102:2: error: #error Target architecture was not detected as supported by v8
 #error Target architecture was not detected as supported by v8
  ^
../deps/v8/src/base/build_config.h:140:2: error: #error Unknown target architecture pointer size
 #error Unknown target architecture pointer size
  ^
../deps/v8/src/base/build_config.h:202:2: error: #error Unknown target architecture endianness
 #error Unknown target architecture endianness
  ^
make[2]: *** [/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcbe-ubuntu1404/out/Release/obj.target/node/src/backtrace.o] Error 1

@cjihrig
Copy link
Contributor

cjihrig commented May 13, 2016

LGTM, but yea, was just about to say what @Fishrock123 did.

@MylesBorins
Copy link
Contributor

/cc @mhdawson re plinux error

@bnoordhuis bnoordhuis force-pushed the print-backtrace-on-fatal-error branch from 887c8cb to 9c63535 Compare May 13, 2016 16:55
@bnoordhuis
Copy link
Member Author

Different approach that should work on all platforms: https://ci.nodejs.org/job/node-test-pull-request/2637/

@Fishrock123
Copy link
Contributor

@bnoordhuis Looks like that failed on smartos:

../src/backtrace_posix.cc
../src/backtrace_posix.cc: In function 'void node::DumpBacktrace(std::FILE*)':
../src/backtrace_posix.cc:20:47: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
     const bool have_info = dladdr(frame, &info);
                                               ^
In file included from ../src/backtrace_posix.cc:4:0:
/usr/include/dlfcn.h:115:12: error:   initializing argument 1 of 'int dladdr(void*, Dl_info*)' [-fpermissive]
 extern int dladdr(void *, Dl_info *);
            ^
node.target.mk:186: recipe for target '/home/iojs/build/workspace/node-test-commit-smartos/nodes/smartos14-32/out/Release/obj.target/node/src/backtrace_posix.o' failed

@bnoordhuis
Copy link
Member Author

God, smartos is like a time machine back to the '90s. Okay, loosened the const-ness. CI: https://ci.nodejs.org/job/node-test-pull-request/2638/

@Fishrock123
Copy link
Contributor

@bnoordhuis smartos still 🚒

@bnoordhuis
Copy link
Member Author

Looks like something went wrong. Again: https://ci.nodejs.org/job/node-test-pull-request/2639/

@bnoordhuis
Copy link
Member Author

Finally, green except for flaky parallel/test-debug-port-cluster on freebsd.

@cjihrig
Copy link
Contributor

cjihrig commented May 16, 2016

Works on my machine. This might be a silly question, but does the CI actually exercise this at all?

@bnoordhuis
Copy link
Member Author

Not intentionally, I don't think. I thought about adding a test but it would be rather anti-social when core dumps are enabled.

@cjihrig
Copy link
Contributor

cjihrig commented May 16, 2016

@bnoordhuis I added a minimal test in cjihrig@3ce55fa. The abort tests aren't run anywhere (that I know of, but it would be nice to have at least something that can test it. Thoughts?

@bnoordhuis bnoordhuis force-pushed the print-backtrace-on-fatal-error branch from 4ab11e0 to f15eb7b Compare May 19, 2016 10:14
@bnoordhuis
Copy link
Member Author

@cjihrig Thanks, added to the PR. Anyone wants to take one more quick look?

@addaleax
Copy link
Member

I guess the test should be skipped on Windows? Other than that still LGTM.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, the RE should probably start with ^\s* and end with $, otherwise the optional parts here are pointless

@bnoordhuis bnoordhuis force-pushed the print-backtrace-on-fatal-error branch from f15eb7b to e52e6d2 Compare May 23, 2016 10:57
@bnoordhuis
Copy link
Member Author

Updated the test, PTAL. CI: https://ci.nodejs.org/job/node-test-pull-request/2741/

@addaleax
Copy link
Member

LGTM if CI is green

@cjihrig
Copy link
Contributor

cjihrig commented May 23, 2016

LGTM. Seems to be an issue with the CI though.

@cjihrig
Copy link
Contributor

cjihrig commented May 31, 2016

Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
`python tools/test.py abort` won't work without one.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
The --abort-on-uncaught-exception can terminate the process with either
a SIGABRT or a SIGILL signal but the test only expected SIGABRT.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Print a C backtrace on fatal errors to make it easier to debug issues
like #6727.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Print a C backtrace on fatal errors to make it easier to debug issues.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
This commit adds a test that validates backtraces which are
printed on fatal errors.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Don't inline calls to node::DumpBacktrace() and fflush(), it makes the
generated code bigger.  A secondary benefit of moving it to a function
is that it gives you something to put a breakpoint on.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Print a C backtrace on fatal errors to make it easier to debug issues.

PR-URL: #6734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Fishrock123 Fishrock123 mentioned this pull request Jul 5, 2016
@MylesBorins
Copy link
Contributor

@bnoordhuis should this be backported?

@bnoordhuis
Copy link
Member Author

Ideally, yes.

@MylesBorins
Copy link
Contributor

due to the AIX + compiler failures I'm going to hold off on this change for the v4.5.0 release

@bnoordhuis would you be willing to backport this PR along with #7508, #7544, and any other potential commits that need to land with this?

@MylesBorins
Copy link
Contributor

ping @bnoordhuis sorry about the other message. Would you be willing to backport a working version of this as mentioned above

gibfahn pushed a commit to gibfahn/node that referenced this pull request Nov 28, 2017
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: nodejs#6734
Backport-PR-URL: nodejs#16550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 28, 2017
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: #6734
Backport-PR-URL: #16550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 7, 2017
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: #6734
Backport-PR-URL: #16550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 8, 2017
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: #6734
Backport-PR-URL: #16550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 28, 2018
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: #6734
Backport-PR-URL: #16550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 30, 2018
There is no real need and it causes endless grief on Windows with some
of the upcoming changes.

PR-URL: #6734
Backport-PR-URL: #16550
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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++. lib / src Issues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants