You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/10/03 17:46:19 UTC
[ignite-teamcity-bot] branch master updated: Java level deadlock
detection: Phase 1: warning
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/master by this push:
new 77c2f41 Java level deadlock detection: Phase 1: warning
77c2f41 is described below
commit 77c2f411726de0ee866e4108571be0fc44b1430f
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Wed Oct 3 20:46:15 2018 +0300
Java level deadlock detection: Phase 1: warning
---
.../apache/ignite/ci/IgniteTeamcityConnection.java | 112 +++++++--------------
.../apache/ignite/ci/analysis/LogCheckResult.java | 40 ++++++--
.../apache/ignite/ci/analysis/LogCheckTask.java | 20 ++--
.../ignite/ci/analysis/SingleBuildRunCtx.java | 18 ++--
.../ignite/ci/analysis/TestLogCheckResult.java | 5 +
.../ci/chain/TrackedBranchChainsProcessor.java | 7 +-
.../org/apache/ignite/ci/issue/IssueDetector.java | 2 +-
.../org/apache/ignite/ci/logs/LogMsgToWarn.java | 15 +++
.../ignite/ci/logs/handlers/TestLogHandler.java | 30 +++---
.../ci/logs/handlers/ThreadDumpCopyHandler.java | 85 ----------------
.../logs/handlers/ThreadDumpInMemoryHandler.java | 3 +-
.../runners/IgniteTeamcityHelperRunnerExample.java | 39 +------
.../ci/web/model/current/SuiteCurrentStatus.java | 4 +-
ignite-tc-helper-web/src/main/webapp/build.html | 3 +-
14 files changed, 135 insertions(+), 248 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
index 4c873b1..2b2d365 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
@@ -22,13 +22,37 @@ import com.google.common.base.Stopwatch;
import com.google.common.base.Strings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.gson.Gson;
-import org.apache.ignite.ci.analysis.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.UncheckedIOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.inject.Inject;
+import javax.xml.bind.JAXBException;
+import org.apache.ignite.ci.analysis.ISuiteResults;
+import org.apache.ignite.ci.analysis.LogCheckResult;
+import org.apache.ignite.ci.analysis.LogCheckTask;
+import org.apache.ignite.ci.analysis.SingleBuildRunCtx;
import org.apache.ignite.ci.di.AutoProfiling;
import org.apache.ignite.ci.github.PullRequest;
import org.apache.ignite.ci.logs.BuildLogStreamChecker;
-import org.apache.ignite.ci.logs.LogsAnalyzer;
-import org.apache.ignite.ci.logs.handlers.TestLogHandler;
-import org.apache.ignite.ci.logs.handlers.ThreadDumpCopyHandler;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.agent.AgentsRef;
import org.apache.ignite.ci.tcmodel.changes.Change;
@@ -47,29 +71,15 @@ import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrences;
import org.apache.ignite.ci.tcmodel.user.User;
import org.apache.ignite.ci.tcmodel.user.Users;
import org.apache.ignite.ci.teamcity.ITeamcityHttpConnection;
-import org.apache.ignite.ci.util.*;
-import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.ci.util.ExceptionUtil;
+import org.apache.ignite.ci.util.HttpUtil;
+import org.apache.ignite.ci.util.UrlUtil;
+import org.apache.ignite.ci.util.XmlUtil;
+import org.apache.ignite.ci.util.ZipUtil;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.inject.Inject;
-import javax.xml.bind.JAXBException;
-import java.io.*;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.*;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.concurrent.CompletableFuture.supplyAsync;
import static org.apache.ignite.ci.HelperConfig.ensureDirExist;
@@ -387,51 +397,6 @@ public class IgniteTeamcityConnection implements ITeamcity {
return zipFileFut.thenApplyAsync(ZipUtil::unZipToSameFolder, executor);
}
- @Deprecated
- public List<CompletableFuture<File>> standardProcessLogs(int... buildIds) {
- List<CompletableFuture<File>> futures = new ArrayList<>();
-
- for (int buildId : buildIds)
- futures.add(standardProcessOfBuildLog(buildId));
-
- return futures;
- }
-
- @Deprecated
- private CompletableFuture<File> standardProcessOfBuildLog(int buildId) {
- final Build results = getBuild(buildId);
- final MultBuildRunCtx ctx = loadTestsAndProblems(results);
-
- if (ctx.hasTimeoutProblem())
- System.err.println(ctx.suiteName() + " failed with timeout " + buildId);
-
- final CompletableFuture<File> zipFut = downloadBuildLogZip(buildId);
- boolean dumpLastTest = ctx.hasSuiteIncompleteFailure();
-
- final CompletableFuture<File> clearLogFut = unzipFirstFile(zipFut);
-
- final ThreadDumpCopyHandler threadDumpCp = new ThreadDumpCopyHandler();
- final TestLogHandler lastTestCp = new TestLogHandler();
- lastTestCp.setSaveLastTestToFile(dumpLastTest);
-
- final Function<File, File> analyzer = new LogsAnalyzer(threadDumpCp, lastTestCp);
-
- final CompletableFuture<File> fut2 = clearLogFut.thenApplyAsync(analyzer);
-
- return fut2.thenApplyAsync(file -> {
- LogCheckResult logCheckRes = new LogCheckResult();
-
- if (dumpLastTest)
- logCheckRes.setLastStartedTest(lastTestCp.getLastTestName());
-
- logCheckRes.setTests(lastTestCp.getTests());
-
- System.err.println(logCheckRes);
-
- return new T2<>(file, logCheckRes);
- }).thenApply(T2::get1);
- }
-
@AutoProfiling
public CompletableFuture<File> unzipFirstFile(CompletableFuture<File> fut) {
final CompletableFuture<List<File>> clearFileF = unzip(fut);
@@ -441,13 +406,6 @@ public class IgniteTeamcityConnection implements ITeamcity {
}, executor);
}
- @Deprecated
- public List<CompletableFuture<File>> standardProcessAllBuildHistory(String buildTypeId, String branch) {
- List<BuildRef> allBuilds = getFinishedBuildsIncludeSnDepFailed(buildTypeId, branch);
-
- return standardProcessLogs(allBuilds.stream().mapToInt(BuildRef::getId).toArray());
- }
-
/**
* @return Basic auth token.
*/
@@ -681,8 +639,8 @@ public class IgniteTeamcityConnection implements ITeamcity {
return getBuildsInState(projectId, branch, state, null);
}
- @Override
- public String serverId() {
+ /** {@inheritDoc} */
+ @Override public String serverId() {
return tcName;
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckResult.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckResult.java
index ea8d8c2..2d93212 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckResult.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckResult.java
@@ -18,25 +18,39 @@
package org.apache.ignite.ci.analysis;
import com.google.common.base.MoreObjects;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
import org.apache.ignite.ci.db.Persisted;
+import org.jetbrains.annotations.Nullable;
/**
* Persistable Log from suite run check task result.
*/
@Persisted
public class LogCheckResult implements IVersionedEntity {
- private static final int LATEST_VERSION = 5;
+ /** Latest version. */
+ private static final int LATEST_VERSION = 6;
+ /** Entity version. */
@SuppressWarnings("FieldCanBeLocal") private Integer _version = LATEST_VERSION;
/** Last started test. Optionally filled from log post processor */
private String lastStartedTest;
+ /** Last thread dump. */
private String lastThreadDump;
- private Map<String, TestLogCheckResult> testLogCheckResult;
+ /**
+ * Test name -> its log check results
+ */
+ private Map<String, TestLogCheckResult> testLogCheckResult = new TreeMap<>();
+
+ @Nullable
+ private Set<String> buildCustomProblems = null;
public void setLastStartedTest(String lastStartedTest) {
this.lastStartedTest = lastStartedTest;
@@ -62,11 +76,13 @@ public class LogCheckResult implements IVersionedEntity {
return lastThreadDump;
}
+ /** {@inheritDoc} */
@Override public String toString() {
return MoreObjects.toStringHelper(this)
.add("lastStartedTest", lastStartedTest)
.add("lastThreadDump", lastThreadDump)
.add("testWarns", getWarns())
+ .add("buildCustomProblems", buildCustomProblems)
.toString();
}
@@ -89,11 +105,23 @@ public class LogCheckResult implements IVersionedEntity {
return sb.toString();
}
- public void setTests(Map<String, TestLogCheckResult> tests) {
- this.testLogCheckResult = tests;
- }
public Map<String, TestLogCheckResult> getTestLogCheckResult() {
- return testLogCheckResult;
+ return Collections.unmodifiableMap(testLogCheckResult);
+ }
+
+ public TestLogCheckResult getOrCreateTestResult(String name) {
+ return testLogCheckResult.computeIfAbsent(name, k -> new TestLogCheckResult());
+ }
+
+ public void addProblem(String code) {
+ if (buildCustomProblems == null)
+ buildCustomProblems = new TreeSet<>();
+
+ buildCustomProblems.add(code);
+ }
+
+ public boolean hasProblem(String deadlock) {
+ return buildCustomProblems!=null && buildCustomProblems.contains(deadlock);
}
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckTask.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckTask.java
index 09973da..cd2949c 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckTask.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/LogCheckTask.java
@@ -22,6 +22,8 @@ import org.apache.ignite.ci.logs.BuildLogStreamChecker;
import org.apache.ignite.ci.logs.handlers.TestLogHandler;
import org.apache.ignite.ci.logs.handlers.ThreadDumpInMemoryHandler;
+import static org.apache.ignite.ci.logs.LogMsgToWarn.JAVA_LEVEL_DEADLOCK;
+
/**
*
*/
@@ -30,16 +32,13 @@ public class LogCheckTask {
private File zipFile;
final ThreadDumpInMemoryHandler threadDumpCp = new ThreadDumpInMemoryHandler();
+ /** Test logger handler. */
final TestLogHandler testLogHandler = new TestLogHandler();
public LogCheckTask(File zipFile) {
this.zipFile = zipFile;
}
- public void setResult(LogCheckResult result) {
- this.result = result;
- }
-
public LogCheckResult getResult() {
return result;
}
@@ -49,14 +48,13 @@ public class LogCheckTask {
}
public void finalize(boolean isIncompleteSuite) {
- LogCheckResult logCheckResult = new LogCheckResult();
- if (isIncompleteSuite) {
- logCheckResult.setLastStartedTest(testLogHandler.getLastTestName());
- logCheckResult.setLastThreadDump(threadDumpCp.getLastThreadDump());
- }
+ LogCheckResult logCheckRes = testLogHandler.getResult(isIncompleteSuite);
- logCheckResult.setTests(testLogHandler.getTests());
+ if (isIncompleteSuite)
+ logCheckRes.setLastThreadDump(threadDumpCp.getLastThreadDump());
+ else if(logCheckRes.hasProblem(JAVA_LEVEL_DEADLOCK))
+ logCheckRes.setLastThreadDump(threadDumpCp.getLastThreadDump());
- setResult(logCheckResult);
+ this.result = logCheckRes;
}
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java
index 8be28d5..9bb50d5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java
@@ -105,6 +105,7 @@ public class SingleBuildRunCtx implements ISuiteResults {
@Nullable
public Map<String, TestLogCheckResult> getTestLogCheckResult() {
LogCheckResult logCheckRes = getLogCheckIfFinished();
+
if (logCheckRes == null)
return null;
@@ -113,26 +114,27 @@ public class SingleBuildRunCtx implements ISuiteResults {
@Nullable
public Integer getBuildIdIfHasThreadDump() {
- LogCheckResult logCheckResult = getLogCheckIfFinished();
- if (logCheckResult == null)
+ LogCheckResult logCheckRes = getLogCheckIfFinished();
+
+ if (logCheckRes == null)
return null;
- return !Strings.isNullOrEmpty(logCheckResult.getLastThreadDump()) ? buildId() : null;
+ return !Strings.isNullOrEmpty(logCheckRes.getLastThreadDump()) ? buildId() : null;
}
@Nullable public LogCheckResult getLogCheckIfFinished() {
if (logCheckResultsFut == null)
return null;
- if (!logCheckResultsFut.isDone() || logCheckResultsFut.isCancelled()) {
+ if (!logCheckResultsFut.isDone() || logCheckResultsFut.isCancelled())
return null;
- }
- LogCheckResult logCheckResult = FutureUtil.getResultSilent(logCheckResultsFut);
+ LogCheckResult logCheckRes = FutureUtil.getResultSilent(logCheckResultsFut);
- if (logCheckResult == null)
+ if (logCheckRes == null)
return null;
- return logCheckResult;
+
+ return logCheckRes;
}
public void setProblems(@Nullable List<ProblemOccurrence> problems) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestLogCheckResult.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestLogCheckResult.java
index c9ddd23..8c16423 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestLogCheckResult.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/TestLogCheckResult.java
@@ -27,9 +27,14 @@ import org.apache.ignite.ci.db.Persisted;
@Persisted
public class TestLogCheckResult {
+ /** Warnings found. */
@Nullable List<String> warns;
+ /** Count of lines. */
int cntLines = 0;
+
+ /** Count of bytes. */
+
int cntBytes = 0;
public void addWarning(String line) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java
index 05ed543..60004eb 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java
@@ -44,15 +44,14 @@ import static com.google.common.base.Strings.isNullOrEmpty;
public class TrackedBranchChainsProcessor {
@Inject private ITcServerProvider srvProv;
+ /** Chains processor. */
@Inject private BuildChainProcessor chainProc;
- @Inject private TcUpdatePool tcUpdatePool;
-
@AutoProfiling
@NotNull
public TestFailuresSummary getTrackedBranchTestFailures(
- @Nullable @QueryParam("branch") String branch,
- @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs,
+ @Nullable String branch,
+ @Nullable Boolean checkAllLogs,
int buildResMergeCnt,
ICredentialsProv creds) {
final TestFailuresSummary res = new TestFailuresSummary();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
index 577e254..af27880 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java
@@ -435,7 +435,7 @@ public class IssueDetector {
protected String checkFailuresEx(String brachName) {
int buildsToQry = EventTemplates.templates.stream().mapToInt(EventTemplate::cntEvents).max().getAsInt();
- tbProc.getTrackedBranchTestFailures(brachName,
+ TestFailuresSummary allHist = tbProc.getTrackedBranchTestFailures(brachName,
false, buildsToQry, backgroundOpsCreds);
TestFailuresSummary failures =
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/LogMsgToWarn.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/LogMsgToWarn.java
index 55814e6..f9410d7 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/LogMsgToWarn.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/LogMsgToWarn.java
@@ -17,6 +17,8 @@
package org.apache.ignite.ci.logs;
+import javax.annotation.Nullable;
+
/**
*
*/
@@ -24,8 +26,21 @@ package org.apache.ignite.ci.logs;
//todo include test name
//todo add NPE
public class LogMsgToWarn {
+
+ private static final String JAVA_LEVEL_DEADLOCK_TXT = " Java-level deadlock:";
+ public static final String JAVA_LEVEL_DEADLOCK = "JAVA_LEVEL_DEADLOCK";
+
public static boolean needWarn(String line) {
return line.contains("java.lang.AssertionError:")
+ || line.contains(JAVA_LEVEL_DEADLOCK_TXT)
|| line.contains("Critical failure. Will be handled accordingly to configured handler");
}
+
+ @Nullable
+ public static String getProblemCode(String line) {
+ if(line.contains(JAVA_LEVEL_DEADLOCK_TXT))
+ return JAVA_LEVEL_DEADLOCK;
+
+ return null;
+ }
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/TestLogHandler.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/TestLogHandler.java
index 2e255ed..b93fce4 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/TestLogHandler.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/TestLogHandler.java
@@ -23,8 +23,6 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
import org.apache.ignite.ci.analysis.LogCheckResult;
import org.apache.ignite.ci.analysis.TestLogCheckResult;
import org.apache.ignite.ci.logs.ILineHandler;
@@ -44,10 +42,7 @@ public class TestLogHandler implements ILineHandler {
public static final TestLogCheckResult FAKE_RESULT = new TestLogCheckResult();
private final List<String> curTestLog = new ArrayList<>();
- /**
- * Test name -> its log check results
- */
- private final Map<String, TestLogCheckResult> tests = new TreeMap<>();
+
private String currentTestName = null;
private File workFolder;
@@ -57,6 +52,9 @@ public class TestLogHandler implements ILineHandler {
private static boolean SAVE_LOG_STAT = true;
+ /** Result. */
+ private LogCheckResult res = new LogCheckResult();
+
@Override public void accept(String line, File fromLogFile) {
if (workFolder == null)
workFolder = fromLogFile.getParentFile();
@@ -85,6 +83,11 @@ public class TestLogHandler implements ILineHandler {
if (LogMsgToWarn.needWarn(line))
curTest().addWarning(line);
+ String problemCode = LogMsgToWarn.getProblemCode(line);
+
+ if (problemCode != null)
+ res.addProblem(problemCode);
+
if (!saveLastTestToFile)
return;
@@ -99,17 +102,14 @@ public class TestLogHandler implements ILineHandler {
}
}
- public TestLogCheckResult curTest() {
+ private TestLogCheckResult curTest() {
String curName = getLastTestName();
- if (curName == null)
- return FAKE_RESULT;
-
- return tests.computeIfAbsent(curName, k -> new TestLogCheckResult());
+ return curName == null ? FAKE_RESULT : res.getOrCreateTestResult(curName);
}
/** {@inheritDoc} */
- @Override public void close() throws Exception {
+ @Override public void close() {
if (saveLastTestToFile && currentTestName != null && !curTestLog.isEmpty())
dumpCurrentToFile("lastStartedTest_");
@@ -160,8 +160,10 @@ public class TestLogHandler implements ILineHandler {
this.saveLastTestToFile = saveLastTestToFile;
}
+ public LogCheckResult getResult(boolean isIncompleteSuite) {
+ if (isIncompleteSuite)
+ res.setLastStartedTest(getLastTestName());
- public Map<String, TestLogCheckResult> getTests() {
- return tests;
+ return res;
}
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpCopyHandler.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpCopyHandler.java
deleted file mode 100644
index bccb496..0000000
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpCopyHandler.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ci.logs.handlers;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.NotThreadSafe;
-import org.apache.ignite.ci.logs.ILineHandler;
-
-/**
- * Use one instance per one file, class is statefull and not thread safe
- */
-@NotThreadSafe
-public class ThreadDumpCopyHandler implements ILineHandler {
- private static final String ENDL = String.format("%n");
- private FileWriter currentThDump;
- private int fileIdx = 0;
- private Integer lastFileIdx = null;
-
- @Override public void accept(String line, File fromLogFile) {
- try {
- acceptX(line, fromLogFile);
- }
- catch (IOException e) {
- throw new UncheckedIOException(e);
- }
- }
-
- private void acceptX(String line, File fromLogFile) throws IOException {
- if (currentThDump == null && line.contains(ThreadDumpInMemoryHandler.FULL_THREAD_DUMP)) {
- lastFileIdx = fileIdx;
- String curFileName = fileName(fileIdx);
- currentThDump = new FileWriter(new File(fromLogFile.getParentFile(), curFileName));
- fileIdx++;
- }
-
- if (line.startsWith("["))
- closeCurrentIfNeed();
-
- if (currentThDump != null) {
- currentThDump.write(line);
- currentThDump.write(ENDL);
- }
-
- }
-
- @Nonnull public static String fileName(int idx) {
- return "ThreadDump" + idx + ".log";
- }
-
- private void closeCurrentIfNeed() throws IOException {
- if (currentThDump != null) {
- currentThDump.close();
- currentThDump = null;
- }
- }
-
- @Override public void close() throws Exception {
- closeCurrentIfNeed();
- }
-
- @Nullable public Integer getLastFileIdx() {
- return lastFileIdx;
- }
-
-}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpInMemoryHandler.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpInMemoryHandler.java
index 7a4d1a8..f9b6aff 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpInMemoryHandler.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/logs/handlers/ThreadDumpInMemoryHandler.java
@@ -52,7 +52,8 @@ public class ThreadDumpInMemoryHandler implements ILineHandler {
}
}
- @Override public void close() throws Exception {
+ /** {@inheritDoc} */
+ @Override public void close() {
closeCurrentIfNeed();
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/IgniteTeamcityHelperRunnerExample.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/IgniteTeamcityHelperRunnerExample.java
index e65f995..33c0634 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/IgniteTeamcityHelperRunnerExample.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/IgniteTeamcityHelperRunnerExample.java
@@ -51,24 +51,8 @@ public class IgniteTeamcityHelperRunnerExample {
int k = 0;
if (k > 0) {
//branch example: "pull/2335/head"
- String branchNameForHist = "pull/2296/head";
List<BuildType> buildTypes = helper.getProjectSuites("Ignite20Tests").get();
- for (BuildType bt : buildTypes) {
- System.err.println(bt.getId());
-
- if (bt.getName().toLowerCase().contains("pds")
- // || bt.getName().toLowerCase().contains("cache")
- ) {
- int[] ints = helper.getBuildNumbersFromHistory(bt.getName(), branchNameForHist);
-
- List<CompletableFuture<File>> fileFutList = helper.standardProcessLogs(ints);
- List<File> collect = getFuturesResults(fileFutList);
- for (File logfile : collect) {
- System.out.println("Cached locally: [" + logfile.getCanonicalPath()
- + "], " + logfile.toURI().toURL());
- }
- }
- }
+
}
int b = 0;
@@ -86,27 +70,6 @@ public class IgniteTeamcityHelperRunnerExample {
helper.triggerBuild(buildTypeIdAll, branchName, true, false);
}
-
- int j = 0;
- if (j > 0) {
- List<CompletableFuture<File>> fileFutList = helper.standardProcessLogs(1155133);
- List<File> collect = getFuturesResults(fileFutList);
- for (File next : collect)
- System.out.println("Cached locally: [" + next.getCanonicalPath() + "], " + next.toURI().toURL());
- }
-
- int h = 0;
- if (h > 0) {
- String branchName1 = "<default>";
- final String branchName = "pull/3475/head";
- List<CompletableFuture<File>> futures = helper.standardProcessAllBuildHistory(
- "IgniteTests24Java8_IgnitePds2DirectIo",
- branchName);
-
- List<File> collect = getFuturesResults(futures);
- for (File next : collect)
- System.out.println("Cached locally: [" + next.getCanonicalPath() + "], " + next.toURI().toURL());
- }
}
private static void checkBuildTypes(IgniteTeamcityConnection helper) throws InterruptedException, ExecutionException {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
index 41931cb..040cad1 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
@@ -198,8 +198,8 @@ import static org.apache.ignite.ci.util.UrlUtil.escape;
suite.getBuildsWithThreadDump().forEach(buildId -> {
webUrlThreadDump = "/rest/" + GetBuildLog.GET_BUILD_LOG + "/" + GetBuildLog.THREAD_DUMP
+ "?" + GetBuildLog.SERVER_ID + "=" + teamcity.serverId()
- + "&" + GetBuildLog.BUILD_NO + "=" + Integer.toString(buildId)
- + "&" + GetBuildLog.FILE_IDX + "=" + Integer.toString(-1);
+ + "&" + GetBuildLog.BUILD_NO + "=" + buildId
+ + "&" + GetBuildLog.FILE_IDX + "=" + -1;
});
runningBuildCount = suite.runningBuildCount();
diff --git a/ignite-tc-helper-web/src/main/webapp/build.html b/ignite-tc-helper-web/src/main/webapp/build.html
index 91f7beb..badfe4f 100644
--- a/ignite-tc-helper-web/src/main/webapp/build.html
+++ b/ignite-tc-helper-web/src/main/webapp/build.html
@@ -98,7 +98,8 @@ function showData(result) {
var txtUrl = "rest/build/failures/txt" + parmsForRest();
$("#divFailures").html(showChainOnServersResults(result)
- + " <a href='"+ txtUrl + "'>txt</a>");
+ // + " <a href='"+ txtUrl + "'>txt</a>"
+ );
}
</script>