Code Monkey home page Code Monkey logo

Comments (1)

bhedge avatar bhedge commented on July 28, 2024

When using blocked-at we had to tune the threshold down very low with the following code:

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

const blockedAt = require('blocked-at');
blockedAt((time, stack) => {
    console.log(`Blocked for ${time}ms, operation started here:`, stack)
},  {threshold:1, trimFalsePositives:true});

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}`)
})

But we saw many false positives with the blocked-at code itself and a few items from the node internals:

Blocked for 2.17335595703125ms, operation started here: [ '    at HTTPParser.emitInitNative (internal/async_hooks.js:131:43)',
  '    at connectionListenerInternal (_http_server.js:336:10)',
  '    at defaultTriggerAsyncIdScope (internal/async_hooks.js:281:19)',
  '    at Server.connectionListener (_http_server.js:313:3)',
  '    at Server.emit (events.js:180:13)',
  '    at TCP.onconnection (net.js:1558:8)' ]

We want to ensure we can accurately detect main thread blocking as we add each of the elements back to our app and wanted to ask your thoughts on the accuracy of these methods to observe main thread blocking.

from node-blocked.

Related Issues (5)

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.