mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RDCT-1200 Fix JetBrains Client doesn't report native crashes
To find and report native crashes `PerformanceWatcherImpl` requires two files: `.pid` and `.appinfo` These files are stored in the system directory (`PathManager.getSystemPath()`). For JetBrainsClient we replace default system path (`JetBrains/IntelliJIdea[VERSION]`) with custom per process path (`JetBrains/JetBrainsClient[VERSION]/tmp/per_process_system_0`) This custom directory is cleaned up on every start therefore `.pid` and `.appinfo` files are also deleted and `PerformanceWatcherImpl` cannot send crash reports. To fix that, we now keep these files between client restarts. GitOrigin-RevId: 7c50445d07767cc3a12e36c5511778235e8142b6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
78be43bdb1
commit
e68cdb6036
+9
-1
@@ -5,6 +5,7 @@ import com.intellij.openapi.application.PathCustomizer;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.project.impl.P3SupportInstaller;
|
||||
import com.intellij.openapi.util.io.NioFiles;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -15,6 +16,7 @@ import java.nio.channels.FileLock;
|
||||
import java.nio.file.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.idea.Main.customTargetDirectoryToImportConfig;
|
||||
import static com.intellij.idea.Main.isConfigImportNeeded;
|
||||
@@ -30,6 +32,12 @@ import static com.intellij.idea.Main.isConfigImportNeeded;
|
||||
public final class PerProcessPathCustomizer implements PathCustomizer {
|
||||
private static final String LOCK_FILE_NAME = "process.lock";
|
||||
|
||||
private static final Set<String> FILES_TO_KEEP = ContainerUtil.newHashSet(
|
||||
LOCK_FILE_NAME,
|
||||
".pid", // Required by PerformanceWatcherImpl to report native crashes
|
||||
".appinfo" // Required by PerformanceWatcherImpl to report native crashes
|
||||
);
|
||||
|
||||
// Leave the folder locked until we exit. Store reference to keep CleanerFactory from releasing the file channel.
|
||||
@SuppressWarnings("unused") private static FileLock ourConfigLock;
|
||||
private static volatile boolean enabled;
|
||||
@@ -141,7 +149,7 @@ public final class PerProcessPathCustomizer implements PathCustomizer {
|
||||
private static void cleanDirectory(@NotNull Path directory) {
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
|
||||
stream.forEach(path -> {
|
||||
if (!path.getFileName().toString().equals(LOCK_FILE_NAME)) {
|
||||
if (!FILES_TO_KEEP.contains(path.getFileName().toString())) {
|
||||
try {
|
||||
NioFiles.deleteRecursively(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user