-
Notifications
You must be signed in to change notification settings - Fork 10
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
Examples of dangerous bugs and diagnostics catching them #40
Comments
further idea: write a function that uses v8 objects and does not have a handlescope and leaks therefore. Ensure that the leak checker run on travis catches the leak. |
This ticket is blue sky and most valuable for thinking about what is possible. However @mapsam over in mapbox/hpp-skel#17 (comment) just did a quick test in hpp-skel to add a bug in a throwaway branch to confirm manually that the sanitizers are working. We should do the same for node-cpp-skel here, just to quickly confirm they are working. @mapsam want to pair with @GretaCB on this in a free moment?
|
@springmeyer I created a throwaway branch and removed the Handlescopes to trigger undefined behaviour within the threadpool. Looks like Travis successfully failed with the undefined sanitizer 🎉 |
👍 Per chat, this proves that things are working. Which is great. So, going forward we'll be confident that if we make a coding mistake in node-cpp-skel (or a project based on it) we should have help from the address and undefined sanitizer. Note: The error that was thrown in your branch actually is one that was suppressed in the master branch. It is coming from the node-cpp-skel/scripts/setup.sh Line 94 in 72092b4
|
@GretaCB - noticed your last commit definitely triggered the use-after-free error, as we hoped! 🎉 The sanitizer output is verbose, but the key thing to note is the type of error
at https://travis-ci.org/mapbox/node-cpp-skel/jobs/262424521#L664 |
Gave a couple more bugs a try in the sanitizer:
|
Per chat - this ^^ is great news. I now propose pausing on this quest. There are ideas in the description of even more types of problems we could try to trigger (to see if the sanitizers catch the errors). But for the sake of time, probably best to use node-cpp-skel as a place to build-back checks when we hit real world problems. And not put more effort now into trying to simulate errors. I'll therefore close this and re-open new issues if/when we:
|
Context
Currently the scope of skel is best practices through working examples.
However in #29 we are experimenting with writing sample code that exhibits "common performance problems" like thread contention along with code that demonstrates idealized cpu usage for async code. The motivation is that:
thread contention
is quietly sinister: you can't see it, there is no obvious crash or error. Just a slow program.So, we plan to document the tell-tale signs of things like
thread contention
when seen via a profiler.Demonstrating diagnostics to catch hard to see bugs
Similar to
thread contention
that may be difficult to diagnose without specialized methods like function level profiling, there is a class of dangerous bugs that can cause silent memory corruption and are not often detectable without advanced methods.Therefore, we could consider adding example code (perhaps first in an advanced branch) that contains intentional dangerous bugs that corrupt memory. Then write documentation for how to detect them.
Examples/ideas:
node_g
(debug node build) and leverage the advanced checks in V8 that catch programming errors and abort: https://github.com/nodejs/node/blob/73ae2d1895c2c0d1d4eeaddd284c58d776d2be87/deps/v8/src/base/logging.hnode --verify-heap
flag to catch the problem. This could be tricky, but we can learn from how the v8 engineers try to do this: https://bugs.chromium.org/p/v8/issues/detail?id=2120The text was updated successfully, but these errors were encountered: