Skip to content
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

src: force gc for flaky (deadlock) tests #57476

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,10 @@ PerProcessOptionsParser::PerProcessOptionsParser(
"force FIPS crypto (cannot be disabled)",
&PerProcessOptions::force_fips_crypto,
kAllowedInEnvvar);
AddOption("--force-gc-for-test",
"",
&PerProcessOptions::force_gc_for_test,
kAllowedInEnvvar);
AddOption("--secure-heap",
"total size of the OpenSSL secure heap",
&PerProcessOptions::secure_heap,
Expand Down
1 change: 1 addition & 0 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class PerProcessOptions : public Options {
std::string snapshot_blob;

std::vector<std::string> security_reverts;
bool force_gc_for_test = false;
bool print_bash_completion = false;
bool print_help = false;
bool print_v8_help = false;
Expand Down
5 changes: 5 additions & 0 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,11 @@ void NodePlatform::DrainTasks(Isolate* isolate) {
if (!per_isolate) return;

do {
if (per_process::cli_options->force_gc_for_test) {
isolate->RequestGarbageCollectionForTesting(
Isolate::GarbageCollectionType::kFullGarbageCollection);
}

// Worker tasks aren't associated with an Isolate.
worker_thread_task_runner_->BlockingDrain();
} while (per_isolate->FlushForegroundTasksInternal());
Expand Down