summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-09-27 12:08:54 +0200
committerTor Egge <Tor.Egge@online.no>2021-09-27 12:08:54 +0200
commit5f3e36ed5ad650a9167725e4cfcb8e246e4fb839 (patch)
tree210106b293abd27c3d7d4b94b446b5a37957fb9d /searchlib
parent9377da84086392e118d69b467006e73fe9ae3f70 (diff)
Specify stack size for compiler when resolving blueprint.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp12
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);