diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-09-27 07:08:36 +0000 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-09-27 07:08:36 +0000 |
commit | fe64026f259df982a7c5a5bdf093603dfb3e486d (patch) | |
tree | af2eb9124be1bcec9c359a8029ef1425eea3afdb /container-disc | |
parent | 4f0e63ee85a845b4b959bd70a9661b63cb590344 (diff) | |
parent | 9377da84086392e118d69b467006e73fe9ae3f70 (diff) |
Merge branch 'master' into bratseth/linguistics-components
Conflicts:
linguistics-components/src/main/resources/configdefinitions/sentence-piece.def
linguistics/src/main/resources/configdefinitions/language.sentencepiece.sentence-piece.def
linguistics/src/main/resources/configdefinitions/sentence-piece.def
Diffstat (limited to 'container-disc')
-rw-r--r-- | container-disc/pom.xml | 2 | ||||
-rw-r--r-- | container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/container-disc/pom.xml b/container-disc/pom.xml index f72348707c2..7d6a1ebb9d5 100644 --- a/container-disc/pom.xml +++ b/container-disc/pom.xml @@ -167,7 +167,6 @@ <buildLegacyVespaPlatformBundle>true</buildLegacyVespaPlatformBundle> <discPreInstallBundle> <!-- Vespa bundles --> - configgen.jar, config-bundle-jar-with-dependencies.jar, configdefinitions-jar-with-dependencies.jar, container-search-and-docproc-jar-with-dependencies.jar, @@ -179,7 +178,6 @@ vespaclient-container-plugin-jar-with-dependencies.jar, vespa-athenz-jar-with-dependencies.jar, security-utils-jar-with-dependencies.jar, - defaults-jar-with-dependencies.jar, zkfacade-jar-with-dependencies.jar, zookeeper-server-jar-with-dependencies.jar, <!-- Apache http client repackaged as bundle --> diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java b/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java index 853224a5b91..457d4fc96a9 100644 --- a/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java +++ b/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.container.jdisc; +import com.google.common.util.concurrent.AtomicDouble; import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Injector; @@ -43,7 +44,6 @@ import com.yahoo.vespa.config.ConfigKey; import com.yahoo.vespa.defaults.Defaults; import com.yahoo.yolean.Exceptions; -import java.io.IOException; import java.util.Collections; import java.util.HashSet; import java.util.IdentityHashMap; @@ -54,6 +54,7 @@ import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; @@ -74,6 +75,8 @@ public final class ConfiguredApplication implements Application { private final String configId; private final OsgiFramework osgiFramework; private final com.yahoo.jdisc.Timer timerSingleton; + private final AtomicBoolean dumpHeapOnShutdownTimeout = new AtomicBoolean(false); + private final AtomicDouble shudownTimeoutS = new AtomicDouble(50.0); // Subscriber that is used when this is not a standalone-container. Subscribes // to config to make sure that container will be registered in slobrok (by {@link com.yahoo.jrt.slobrok.api.Register}) // if slobrok config changes (typically slobroks moving to other nodes) @@ -133,7 +136,7 @@ public final class ConfiguredApplication implements Application { @Override public void start() { qrConfig = getConfig(QrConfig.class, true); - + reconfigure(qrConfig); hackToInitializeServer(qrConfig); ContainerBuilder builder = createBuilderWithGuiceBindings(); @@ -222,6 +225,7 @@ public final class ConfiguredApplication implements Application { while (true) { subscriber.waitNextGeneration(false); QrConfig newConfig = QrConfig.class.cast(first(subscriber.config().values())); + reconfigure(qrConfig); if (qrConfig.rpc().port() != newConfig.rpc().port()) { com.yahoo.protect.Process.logAndDie( "Rpc port config has changed from " + @@ -235,6 +239,11 @@ public final class ConfiguredApplication implements Application { } } + void reconfigure(QrConfig qrConfig) { + dumpHeapOnShutdownTimeout.set(qrConfig.shutdown().dumpHeapOnTimeout()); + shudownTimeoutS.set(qrConfig.shutdown().timeout()); + } + private void initializeAndActivateContainer(ContainerBuilder builder) { addHandlerBindings(builder, Container.get().getRequestHandlerRegistry(), configurer.getComponent(ApplicationContext.class).discBindingsConfig); @@ -401,13 +410,11 @@ public final class ConfiguredApplication implements Application { private void startShutdownDeadlineExecutor() { shutdownDeadlineExecutor = new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory("Shutdown deadline timer")); shutdownDeadlineExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); - long delayMillis = 50 * 1000; + long delayMillis = (long)(shudownTimeoutS.get() * 1000.0); shutdownDeadlineExecutor.schedule(() -> { - String heapDumpName = Defaults.getDefaults().underVespaHome("var/crash/java_pid.") + ProcessHandle.current().pid() + ".hprof"; - try { + if (dumpHeapOnShutdownTimeout.get()) { + String heapDumpName = Defaults.getDefaults().underVespaHome("var/crash/java_pid.") + ProcessHandle.current().pid() + ".hprof"; com.yahoo.protect.Process.dumpHeap(heapDumpName, true); - } catch (IOException e) { - log.log(Level.WARNING, "Failed writing heap dump:", e); } com.yahoo.protect.Process.logAndDie( "Timed out waiting for application shutdown. Please check that all your request handlers " + |