-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
async hook stack has become corrupted #3585
Comments
Update: issue seems to not appear with |
Got same error, only appears in Node.js 16. Not in Node.js 14 or 15. Copy useful info here: Package + Version
Version:
DescriptionUse Node.js 16.2.0 (latest version writing this), and simply use the demo at import express from "express";
import * as Sentry from "@sentry/node";
// or using CommonJS
// const express = require('express');
// const Sentry = require('@sentry/node');
const app = express();
Sentry.init({ dsn: "https://[email protected]/0" });
// The request handler must be the first middleware on the app
app.use(Sentry.Handlers.requestHandler());
// All controllers should live here
app.get("/", function rootHandler(req, res) {
res.end("Hello world!");
});
// The error handler must be before any other error middleware and after all controllers
app.use(Sentry.Handlers.errorHandler());
// Optional fallthrough error handler
app.use(function onError(err, req, res, next) {
// The error id is attached to `res.sentry` to be returned
// and optionally displayed to the user for support.
res.statusCode = 500;
res.end(res.sentry + "\n");
});
app.listen(3000); The server can start successfully, however, if hit any endpoint such as going to http://localhost:3000 in this case, the server will crash with error /Users/hm/.nvm/versions/node/v16.2.0/bin/node[89516]: ../src/api/callback.cc:125:void node::InternalCallbackScope::Close(): Assertion `(env_->execution_async_id()) == (0)' failed.
1: 0x10ebbf7e5 node::Abort() (.cold.1) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
2: 0x10d872b39 node::Abort() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
3: 0x10d8729a1 node::Assert(node::AssertionInfo const&) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
4: 0x10d7a2cdd node::InternalCallbackScope::Close() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
5: 0x10d7a25de node::InternalCallbackScope::~InternalCallbackScope() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
6: 0x10d813b88 node::Environment::RunTimers(uv_timer_s*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
7: 0x10e267877 uv__run_timers [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
8: 0x10e26c0ad uv_run [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
9: 0x10d7a3ea4 node::SpinEventLoop(node::Environment*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
10: 0x10d8b4414 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
11: 0x10d84097d node::Start(int, char**) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
12: 0x7fff2057a621 start [/usr/lib/system/libdyld.dylib]
13: 0x7 I located, without line |
@kamilogorek I will try to provide a repo with more detailed steps to reproduce today. Thanks! |
@kamilogorek sorry for early misleading demo code. Here you are! https://github.com/Hongbo-Miao/bug-nodejs-16 I further did some research.
So I am guessing some code in OpenTelemetry affects Sentry. |
This is some kind of regression in Node v16.2.0. It's working fine in v16.1.0. The problem however, is incorrect request rejections handling between It's most likely that error thrown within nodejs/node#38503 One additional information here though, is that what's causing an actual error that is crashing the process, is TCP not being able to connect to the OpenTelemetry server, which you can see when using Node
There's nothing that we can do from our side right now, as it's infrastructure specific issue, not the SDK itself. |
Thanks @kamilogorek! |
Hello,
I met strange error after I added sentry to my project. When the error is thrown, the project crashes immediatly.
this:
or this:
sometimes this:
I know it comes with sentry because I tried to remove
Sentry.init
and the error disappears.In my project, I'm using the
async_hooks
API and I fear a conflict with your tracing SDK. I am usingasync_hooks
this way:I am declaring Sentry this way
Do you know how this issue could be solved ?
Thank you for your work :)
Version
Node:
16
(Using Docker imagenode:16-alpine
)Packages
@sentry/node
:6.4.1
@sentry/tracing
:6.4.1
The text was updated successfully, but these errors were encountered: