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

Allow disabling dtrace-provider #417

Closed
wants to merge 1 commit into from
Closed

Allow disabling dtrace-provider #417

wants to merge 1 commit into from

Conversation

robertrossmann
Copy link

This allows people using Node.js >=6 to avoid a bunch of deprecation warnings coming from the C/C++ land in dtrace-provider which uses deprecated APIs.

Usage: Just set BUNYAN_NO_DTRACE to a truthy value and you are all set.

Recommended changelog entry:

  • Allow disabling DTrace support via BUNYAN_NO_DTRACE environment variable

Thanks for review!

This allows people using Node.js >=6 to avoid a bunch of deprecation warnings
in the C/C++ land coming from dtrace-provider which uses deprecated APIs.
@trentm
Copy link
Owner

trentm commented Jul 5, 2016

@Alaneor Sorry for the delay in responding.

What deprecation warnings? Perhaps this is specific to a particular node v6 version or a particular platform? Here is me runnign this on Mac 10.11.4 with node 6.2.2:

[trentm@danger0:~/tm/node-bunyan (master)]
$ node --version
v6.2.2

[trentm@danger0:~/tm/node-bunyan (master)]
$ rm -rf node_modules/

[trentm@danger0:~/tm/node-bunyan (master)]
$ npm install
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

> dtrace-provider@0.6.0 install /Users/trentm/tm/node-bunyan/node_modules/dtrace-provider
> node scripts/install.js

bunyan@1.8.2 /Users/trentm/tm/node-bunyan
├── ben@0.0.0
...
  └── extsprintf@1.0.0

[trentm@danger0:~/tm/node-bunyan (master)]
$ node examples/hi.js
log.info() is: true
{"name":"myapp","hostname":"danger0.local","pid":49087,"level":30,"msg":"hi","time":"2016-07-05T05:44:54.641Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":10},"v":0}
{"name":"myapp","hostname":"danger0.local","pid":49087,"level":30,"msg":"hi trent","time":"2016-07-05T05:44:54.643Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":11},"v":0}
{"name":"myapp","hostname":"danger0.local","pid":49087,"level":30,"msg":"hi true there","time":"2016-07-05T05:44:54.643Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":12},"v":0}
{"name":"myapp","hostname":"danger0.local","pid":49087,"level":30,"foo":"bar","multiline":"one\ntwo\nthree","msg":"hi 1 two 3","time":"2016-07-05T05:44:54.644Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":15},"v":0}


{"name":"myapp","hostname":"danger0.local","pid":49087,"component":"wuzzle","level":30,"msg":"creating a wuzzle","time":"2016-07-05T05:44:54.645Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":23,"func":"Wuzzle"},"v":0}
{"name":"myapp","hostname":"danger0.local","pid":49087,"component":"wuzzle","level":40,"msg":"This wuzzle is woosey.","time":"2016-07-05T05:44:54.645Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":27,"func":"Wuzzle.woos"},"v":0}
{"name":"myapp","hostname":"danger0.local","pid":49087,"level":30,"msg":"done with the wuzzle","time":"2016-07-05T05:44:54.645Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/hi.js","line":32},"v":0}

@ltvolks
Copy link

ltvolks commented Jul 6, 2016

OS: OSX 10.10.5
Node: 6.2.2
Bunyan: 1.8.0

After switching to 6.2.2 from 5.10.1, I began to see Dtrace-related errors like:

Error: Module version mismatch. Expected 48, got 47.
    at Error (native)
    at Object.Module._extensions..node (module.js:568:18)

<snip>

{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:440:15)

<snip>

{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:440:15)

After performing an npm rebuild, I began to see stack traces including deprecation warnings similar to these, which may be what @Alaneor is referring to:

==== C stack trace ===============================

 1: v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)
 <snip v8 calls>
 7: 0xbb66510961b
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.

==== JS stack trace =========================================

Security context: 0x2c4cd92c9e59 <JS Object>#0#
    1: .node [module.js:568] [pc=0xbb66536d1a4] (this=0x14725d4c7ae9 <an Object with map 0x8501ea17d41>#1#,module=0x1d7b644f5921 <a Module with map 0x8501ea18319>#2#,filename=0x1d7b644f5889 <String[128]: /sandbox/node_modules/dtrace-provider/build/Release/DTraceProviderBindings.node>)
    2: load [module.js:~449] [pc=0xbb6654aca76] (this=0x1d7b644f5921 <a Module with map 0x8501ea18319>#2#,filename=0x1d7b644f5889 <String[128]: /sandbox/node_modules/dtrace-provider/build/Release/DTraceProviderBindings.node>)

<snip more of the same Dtrace-related stack>

In the end, I rm -rf /node_modules and reinstalled my dependencies, resolving the errors.

@robertrossmann
Copy link
Author

The deprecation warnings this patch was supposed to avoid are described in this issue. However, the root cause seems to have been fixed upstream (nan) so I do not think this is needed anymore.

I keep this open in case you would be interested to merge it anyway as a means to disable the DTrace functionality completely, perhaps to let users get some small perf boost. Otherwise, feel free to close. Thanks!

@robertrossmann
Copy link
Author

Closing due to no interest to merge this from the Bunyan team.

The original reason for disabling DTrace has been fixed in #449, but disabling it might have improved performance a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants