Giter Club home page Giter Club logo

node-blocked's Introduction

node-blocked's People

Contributors

ensonik avatar indatawetrust avatar juliangruber avatar lmammino avatar millerick avatar naugtur avatar palanik avatar tj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-blocked's Issues

probes

add probes so that you can correlate blocking with a given task

Mention blocked-at in readme

Node8 introduces Async Hooks, which allow for implementing 'blocked' in a way that makes it aware of current execution context.

Suggested mention:

If You're running Node.js 8+ you can get a stacktrace pointing to the blocking function using very similar  [blocked-at](https://github.com/naugtur/blocked-at) package.

I would suggest merging it into blocked, but it's way too early and I believe both packages have their usecases, so instead - let's cross-link them.

I'm making a pull request with a suggestion, but I don't have a strong opinion about where to put the link.

get list of called functions between intervals

when event loop is blocked i would like to see which functions were called during that interval and how many times. especially sync operations. so that i can chase after them ...

probably out of scope or too much for such a small package. but this would help a lot!

Main Thread Reported Blocked when idle

Want to start off by saying thank you for providing this library... while troubleshooting a main thread blocking issue in a Koa app and we systematically removed each element of the app from our server.js file only to find that the main thread will report blocked with the simplest of Node apps.

With either of these code samples in node version 9.8.0:

const Koa = require('koa');
const app = new Koa();

const blocked = require('blocked');
blocked(function(ms) {
    console.log(`!!! >>> MAIN THREAD Blocked for ${ms}ms.`);
}, {threshold:10});

app.use(ctx => {
  ctx.body = '{"debug":"return from debug"}';
});
app.listen(4000);

or

const http = require('http')
const port = 4000

const blocked = require('blocked');
blocked(function(ms) {
    console.log(`!!! >>> MAIN THREAD Blocked for ${ms}ms.`);
}, {threshold:10});

const requestHandler = (request, response) => {
  response.end('{"debug":"return from debug"}')
}

const server = http.createServer(requestHandler)

server.listen(port, (err) => {
  if (err) {
    return console.log('error:', err)
  }

  console.log(`http server listening on port: ${port}`)
})

With output:

http server listening on port: 4000
!!! >>> MAIN THREAD Blocked for 35ms.
!!! >>> MAIN THREAD Blocked for 30ms.
!!! >>> MAIN THREAD Blocked for 45ms.
!!! >>> MAIN THREAD Blocked for 18ms.
!!! >>> MAIN THREAD Blocked for 11ms.
!!! >>> MAIN THREAD Blocked for 11ms.
!!! >>> MAIN THREAD Blocked for 36ms.
...

With either of the code sample above, the main thread will report blocked when the application is idle with no requests inbound to the web server and this points to a node.js internal blocking or node-blocked is misreporting blocking in certain instances. I am new to this level of internals and apologize if this is a known item.

Are there false positives with node-blocked or are we potentially seeing issues within the node core internals?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.