Skip to content

Commit

Permalink
[starter] Don't report freezes from threadDumps folders and only repo…
Browse files Browse the repository at this point in the history
…rt from "errors" folder

All freezes except ones that happens on IDE kill must be there

GitOrigin-RevId: 0316a9543e95e30506136b3a4eb708d32c6560fc
  • Loading branch information
MaXal authored and intellij-monorepo-bot committed Oct 24, 2024
1 parent 005cafd commit 5bda6f1
Showing 1 changed file with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object ErrorReporterToCI: ErrorReporter {
//client has structure log/2024-04-11_at_11-06-10/script-errors so we need to look deeeper
val rootErrorsDir = Files.find(logsDir, 3, { path, _ -> path.name == ErrorReporter.ERRORS_DIR_NAME }).findFirst().getOrNull()
if (SystemProperties.getBooleanProperty("DO_NOT_REPORT_ERRORS", false)) return listOf()
return collectExceptions(rootErrorsDir) + collectFreezes(logsDir)
return collectExceptions(rootErrorsDir)
}

/**
Expand All @@ -35,7 +35,7 @@ object ErrorReporterToCI: ErrorReporter {
fun collectScriptErrors(logsDir: Path): List<Error> {
val rootErrorsDir = Files.find(logsDir, 3, { path, _ -> path.name == "script-" + ErrorReporter.ERRORS_DIR_NAME }).findFirst().getOrNull()
if (SystemProperties.getBooleanProperty("DO_NOT_REPORT_ERRORS", false)) return listOf()
return collectExceptions(rootErrorsDir) + collectFreezes(logsDir)
return collectExceptions(rootErrorsDir)
}

/**
Expand All @@ -59,29 +59,18 @@ object ErrorReporterToCI: ErrorReporter {
if (!stacktraceFile.exists()) continue
val stackTrace = stacktraceFile.readText().trimIndent().trim()
errors.add(Error(messageText, stackTrace, "", errorType))
} else if (errorType == ErrorType.FREEZE) {
errorDir.listDirectoryEntries("dump*").firstOrNull()?.let { threadDump ->
val dumpContent = Files.readString(threadDump)
val fallbackName = "Not analyzed freeze: " + (inferClassMethodNamesFromFolderName(threadDump)
?: inferFallbackNameFromThreadDump(dumpContent))
errors.add(Error(fallbackName, "", dumpContent, ErrorType.FREEZE))
}
}
}
return errors
}

private fun collectFreezes(logDir: Path): List<Error> {
if (!logDir.isDirectory()) {
return emptyList()
}
val freezes = mutableListOf<Error>()
logDir.listDirectoryEntries("threadDumps-freeze*").filter { path ->
Files.isDirectory(path)
}.forEach { path ->
path.listDirectoryEntries("threadDump*").firstOrNull()?.let { threadDump ->
val dumpContent = Files.readString(threadDump)
val fallbackName = "Not analyzed freeze: " + (inferClassMethodNamesFromFolderName(path)
?: inferFallbackNameFromThreadDump(dumpContent))
freezes.add(Error(fallbackName, "", dumpContent, ErrorType.FREEZE))
}
}
return freezes
}

/**
* There are two types of names for folders with freezes:
* ```
Expand Down

0 comments on commit 5bda6f1

Please sign in to comment.