Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Last active May 20, 2016 00:45
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ashleygwilliams/9f64402fe71c572019e6162f8313e0d4 to your computer and use it in GitHub Desktop.

Object.keys(request) - ashley/ceej

BLUEBIRD_LONG_STACK_TRACES=1 - chris

(ooh, just remembered another tip: kill -s USR1 <node pid> will turn the debugger on any node process and you can point node-inspector at it) -chris

ooh another fun debugging tip: dbg = vm.runInDebugContext('Debug'); mirror = dbg.MakeMirror(objectValue); console.log(mirror.referencedBy()) - chris it lists all referencing objects to the object you pass to MakeMirror

turn on browser styles in computed properties in the browser - jeff

git token search aria

maciej when in doubt strace tcpdump dtruss

git bisect + use magic strings and/or really unique tokens "wacky symbols" ryan

ben docker container, just sh into it to debug it

andrew - if you're running enterprise and your ldap is not working making sure replicated has the right ip

ceej

  1. start at the wall socket and follow the cables all the way through. methodically start where something starts and follow it all the way through meticulously and pedanticly. don't make the assumption!
  2. log, log profusely, log often, log in a grepable way. you write logs now to save yourself debuging time later. current self needs to guess what might go wrong in the future
  3. name your functions! your stack traces are WAY better.

tl;dr BE DESCRIPTIVE. have pity on yourself.

@chrisdickinson
Copy link

  • process._rawDebug — blocking write to stderr that skips all stream machinery
  • Mirrors:
const vm = require('vm')
const Debug = vm.runInDebugContext('Debug')
const mirror = Debug.makeMirror(myObjectValue)

console.log(mirror.referencedBy()) // [ ObjectMirror, ObjectMirror, ObjectMirror ]

@chrisdickinson
Copy link

  • kill -s USR1 <node pid>: halt node pid, turn on the debugger (if it's not on already!). You can point node-inspector at localhost:5858 and debug from there!

@chrisdickinson
Copy link

  • in combination with referencedByprocess._getActiveHandles() and process._getActiveRequests() — fetch a list of objects representing active libuv handles and requests. These requests are keeping node from exiting. You can get back to what's referring to them using dbg.MakeMirror(process._getActiveHandles()[0]).referencedBy()!

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