naugtur / blocked-at

Detects node eventloop block and reports where it started
MIT License
321 stars 25 forks source link

Doesn't report garbage collector #26

Closed logidelic closed 5 years ago

logidelic commented 5 years ago

It seems that blocked-at won't report blocking due to garbage collection. For example, I have the following in my code:

var beg = Date.now();
global.gc();
console.log(Date.now()-beg)

Which in my (crazy) case reports 200ms, but blocked-at seems silent about... Could I be misunderstanding something or is this a real deficiency?

naugtur commented 5 years ago

It depends on the function wrapping your code. blocked-at uses async hooks and some of the ways your code can run are not tracked by async hooks (yet, opefully) eg. bluebird promises only recently started being visible to hooks.

If you use native promises and put this code in a then function, it should work. No guarantees though :)

Feel free to reopen

logidelic commented 5 years ago

Two notes:

Thanks regardless for the cool library.