Skip to content

Commit

Permalink
Attempt to log the stack where cross-request promises are being resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Sep 20, 2024
1 parent 3bb0d26 commit 4ab7ac8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/workerd/io/worker.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,20 @@ Worker::Isolate::Isolate(kj::Own<Api> apiParam,
v8::Local<v8::Value> argument)> callback) -> v8::Maybe<void> {
try {
auto& js = jsg::Lock::from(isolate);

{
// TODO(soon): Hopefully this logging is temporary. We want to get an idea
// of where the cross request promises are being resolved just in general.
// To do so we need to try to capture a stack. We do so by creating an error
// object and logging it.
v8::HandleScope handleScope(isolate);
auto err = v8::Exception::Error(js.str(""_kj)).As<v8::Object>();
jsg::check(err->Set(
js.v8Context(), js.str("name"_kj), js.str("Cross Request Promise Resolve"_kj)));
auto stack = jsg::check(err->Get(js.v8Context(), js.str("stack"_kj)));
KJ_LOG(WARNING, kj::str("NOSENTRY ", stack));
}

// The promise tag is generally opaque except for right here. The tag
// wraps an instanceof kj::Own<IoCrossContextExecutor>, which wraps an atomically
// refcounted pointer to the DeleteQueue for the correct isolate.
Expand Down

0 comments on commit 4ab7ac8

Please sign in to comment.