From 142b59a4d5f9377a05df83b754c42bb218e836f0 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Thu, 9 Nov 2017 13:50:15 +0000 Subject: [PATCH] [ML] Use the correct timeout for the process context lock (elastic/x-pack-elasticsearch#2935) This change should have been made in elastic/x-pack-elasticsearch#2913. Now we hold the process context lock throughout the job close procedure, the timeout for trying to lock it should be the timeout used for job open/close rather than the timeout for connecting named pipes. Original commit: elastic/x-pack-elasticsearch@79672b082588e0dcc5248d481a41ca91b593c67f --- .../xpack/ml/job/process/autodetect/ProcessContext.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/ProcessContext.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/ProcessContext.java index 2657a34a3d1..1dda562447a 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/ProcessContext.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/ProcessContext.java @@ -8,6 +8,7 @@ package org.elasticsearch.xpack.ml.job.process.autodetect; import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.action.OpenJobAction.JobTask; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; @@ -54,7 +55,7 @@ final class ProcessContext { void tryLock() { try { - if (lock.tryLock(NativeAutodetectProcessFactory.PROCESS_STARTUP_TIMEOUT.getSeconds(), TimeUnit.SECONDS) == false) { + if (lock.tryLock(MachineLearning.STATE_PERSIST_RESTORE_TIMEOUT.getSeconds(), TimeUnit.SECONDS) == false) { LOGGER.error("Failed to acquire process lock for job [{}]", jobTask.getJobId()); throw ExceptionsHelper.serverError("Failed to acquire process lock for job [" + jobTask.getJobId() + "]"); }