diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-09-27 14:02:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 14:02:02 +0200 |
commit | 1f7454953633f00badd084482ba75eb09b11d52d (patch) | |
tree | 9f61e87b50115971047fa9ff101ec094bb102039 | |
parent | b0f5c6f02043ab616128ceabe9bed0951ea14e2c (diff) | |
parent | 5f3e36ed5ad650a9167725e4cfcb8e246e4fb839 (diff) |
Merge pull request #19301 from vespa-engine/toregge/specify-stack-size-for-compiler-when-resolving-blueprint
Specify stack size for compiler when resolving blueprint.
-rw-r--r-- | searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp index 0a13b196c43..90369009f0e 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp @@ -3,8 +3,10 @@ #include "blueprintresolver.h" #include "blueprintfactory.h" #include "featurenameparser.h" +#include <vespa/vespalib/util/lambdatask.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/size_literals.h> +#include <vespa/vespalib/util/threadstackexecutor.h> #include <stack> #include <cassert> #include <set> @@ -14,6 +16,8 @@ LOG_SETUP(".fef.blueprintresolver"); using vespalib::make_string_short::fmt; +using vespalib::ThreadStackExecutor; +using vespalib::makeLambdaTask; namespace search::fef { @@ -271,8 +275,7 @@ BlueprintResolver::compile() { assert(_executorSpecs.empty()); // only one compilation allowed Compiler compiler(_factory, _indexEnv, _executorSpecs, _featureMap); - std::thread compile_thread([&]() - { + auto compile_task = makeLambdaTask([&]() { compiler.probe_stack(); for (const auto &seed: _seeds) { auto ref = compiler.resolve_feature(seed, Blueprint::AcceptInput::ANY); @@ -282,7 +285,10 @@ BlueprintResolver::compile() _seedMap.emplace(FeatureNameParser(seed).featureName(), ref); } }); - compile_thread.join(); + ThreadStackExecutor executor(1, 8_Mi); + executor.execute(std::move(compile_task)); + executor.sync(); + executor.shutdown(); size_t stack_usage = compiler.stack_usage(); if (stack_usage > (128_Ki)) { LOG(warning, "high stack usage: %zu bytes", stack_usage); |