I am using https://github.com/jeff-lewis/cls-hooked for preserving execution context across async callbacks. I see context dropping during the life span of a request.
I am aware of https://github.com/nodejs/diagnostics/blob/master/tracing/AsyncHooks/problematic-modules.md modules that break async continuity.
How can I find out what other modules are breaking my async continuity? The app is a express based node.js server.
I finally figured out this after I added logging statements throughout my code and realized that context was being dropped at database calls, turns out I was using https://github.com/datastax/nodejs-driver which does connection pooling internally which causes the context drop.
const cassandra = require('cassandra-driver')
let c = new cassandra.Client(// options here...)
c.execute(query, params, options, namespace.bind(function() {
// This callback will now inherit the right parent context
}))
More information about userland queuing problem:
https://docs.google.com/document/d/1tlQ0R6wQFGqCS5KeIw0ddoLbaSYx6aU7vyXOkv-wvlM/edit https://github.com/othiym23/node-continuation-local-storage/issues/59
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With