Skip to content

Commit a1d2ded

Browse files
authored
[ML] Fix unit test deadlock problem (#34174)
This change fixes a potential deadlock problem in the unit test introduced in #34117. It also removes a piece of debug code and corrects a docs formatting problem that were both added in that same PR.
1 parent 2e2ae19 commit a1d2ded

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/reference/ml/apis/find-file-structure.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ If the request does not encounter errors, you receive the following result:
12841284

12851285
If you try to analyze a lot of data then the analysis will take a long time.
12861286
If you want to limit the amount of processing your {es} cluster performs for
1287-
a request, use the timeout query parameter. The analysis will be aborted and
1287+
a request, use the `timeout` query parameter. The analysis will be aborted and
12881288
an error returned when the timeout expires. For example, you can replace 20000
12891289
lines in the previous example with 200000 and set a 1 second timeout on the
12901290
analysis:

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/filestructurefinder/FileStructureFinderManagerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,16 @@ public void testFindFileStructureTimeout() throws IOException, InterruptedExcept
157157
// Expected if timeout occurs and the input stream is closed before junk generation is complete
158158
}
159159
});
160-
junkProducer.start();
161160

162161
try (InputStream bigInput = new PipedInputStream(generator)) {
163162

163+
junkProducer.start();
164+
164165
ElasticsearchTimeoutException e = expectThrows(ElasticsearchTimeoutException.class,
165166
() -> structureFinderManager.findFileStructure(explanation, linesOfJunk - 1, bigInput, EMPTY_OVERRIDES, timeout));
166167

167168
assertThat(e.getMessage(), startsWith("Aborting structure analysis during ["));
168169
assertThat(e.getMessage(), endsWith("] as it has taken longer than the timeout of [" + timeout + "]"));
169-
explanation.add(e.getMessage());
170170
}
171171

172172
// This shouldn't take anything like 10 seconds, but VMs can stall so it's best to

0 commit comments

Comments
 (0)