-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trace_events: when enabling via inspector after startup, process abort #23185
Comments
@ofrobots Do you have any idea where i should look at to find the root cause of this bug ? |
cc @nodejs/diagnostics |
@vmarchaud if you could share a sample code without 3rd party libraries to reproduce this failure, or a |
@vmarchaud Are you still experiencing this problem? |
@Trott I believe its still a problem but i need to verify against the latest 10.x or 11.x version. |
I'm able to reproduce the crash with 10.13.0, i have a core dump that i can send you @mmarchini , do you have any email i can contact you ? |
And there is a sample that reproduce the problem for me : const http = require('http')
const port = 3000
const inspector = require('inspector')
const fs = require('fs')
const session = new inspector.Session()
session.connect()
const opts = {
includedCategories: [
'node'
],
recordContinuously: false
}
const requestHandler = (request, response) => {
response.end('Hello Node.js Server!')
}
const server = http.createServer(requestHandler)
server.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(`server is listening on ${port}`)
// launching the tracing
session.post('NodeTracing.start', {
traceConfig: opts
})
console.log(`Starting NodeTracing`)
// lets stop after 10 sec
setTimeout(_ => {
const events = []
session.on('NodeTracing.tracingComplete', () => {
console.log(`Finished with success`)
const data = events.reduce((agg, events) => {
agg = agg.concat(events.value)
return agg
}, [])
fs.writeFileSync('./trace.json', JSON.stringify(data))
console.log(`Saved file with trace events`)
return process.exit(0)
})
session.on('NodeTracing.dataCollected', (event) => {
events.push(event.data)
})
console.log(`Stopping NodeTracing`)
session.post('NodeTracing.stop', {
traceConfig: opts
})
}, 5000)
}) You just need to make a few request to the server, for example i'm using wrk -c 10 -t 3 -d 5 http://localhost:3000 |
I can reproduce the abort with the provided test. Taking a look.... |
|
We crash because we are trying to access the main thread isolate on the tracing agent thread. The main thread also happens to be active and has the isolate lock. @eugeneo would you have time to look at this? |
Linux 4.4.0-122-generic #146-Ubuntu SMP Mon Apr 23 15:34:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I'm playing around with the new NodeTracing domain (cf nodejs/diagnostics#220), trying to collect trace events at runtime in our APM (implementation is still wip so don't mind the code).
Everything was working great in test but when i deployed in our staging environment (and putting a some load with
wrk-node
), i apparently hit a race condition that cause that make the process abort : https://github.com/nodejs/node/blob/master/deps/v8/src/api.cc#L1059I only get the debug line outputted by V8 before the abort happen, so not so much information here.
I can reproduce almost every time with our API, i assume i will be able to make a sample so everyone can reproduce on their own, in the mean time i'm already open the issue to discuss it.
I can recompile node with any patch if needed and test directly on my staging env.
@eugeneo if you have any idea, i'm able to put some hours into debugging it the coming week
The text was updated successfully, but these errors were encountered: