Merge pull request #7860 from gdicristofaro/AUT-2475_warningForInsufficientMem

AUT-2475 warning for insufficient mem
This commit is contained in:
Mark McKinnon 2023-10-11 13:11:06 -04:00 committed by GitHub
commit 519e8d1c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -2,6 +2,10 @@ Installer.closing.confirmationDialog.message=Ingest is running, are you sure you
Installer.closing.confirmationDialog.title=Ingest is Running
# {0} - exception message
Installer.closing.messageBox.caseCloseExceptionMessage=Error closing case: {0}
# {0} - maxMemory
Installer_checkMemoryAvailable_maxMemExpected_desc=Maximum JVM memory: {0}, is less than the 2 GB required. Some aspects of the application may not work as expected.
# {0} - physicalMemory
Installer_checkMemoryAvailable_physicalRamExpected_desc=Physical memory: {0}, is less than the 8 GB required. Some aspects of the application may not work as expected.
OpenIDE-Module-Display-Category=Infrastructure
OpenIDE-Module-Long-Description=\
This is the core Autopsy module.\n\n\

View File

@ -20,8 +20,10 @@ package org.sleuthkit.autopsy.core;
import com.sun.jna.platform.win32.Kernel32;
import java.awt.Cursor;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@ -34,6 +36,7 @@ import java.util.logging.Level;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import net.sf.sevenzipjbinding.SevenZip;
import net.sf.sevenzipjbinding.SevenZipNativeInitializationException;
import org.apache.commons.io.FileUtils;
@ -41,6 +44,7 @@ import org.apache.commons.lang3.StringUtils;
import org.openide.modules.InstalledFileLocator;
import org.openide.modules.ModuleInstall;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.actions.IngestRunningCheck;
import org.sleuthkit.autopsy.casemodule.Case;
@ -373,6 +377,7 @@ public class Installer extends ModuleInstall {
@Override
public void restored() {
super.restored();
checkMemoryAvailable();
ensurePythonModulesFolderExists();
ensureClassifierFolderExists();
ensureOcrLanguagePacksFolderExists();
@ -392,6 +397,40 @@ public class Installer extends ModuleInstall {
preloadTranslationServices();
}
/**
* Checks system resources logging any potential issues.
*/
@Messages({
"# {0} - physicalMemory",
"Installer_checkMemoryAvailable_physicalRamExpected_desc=Physical memory: {0}, is less than the 8 GB required. Some aspects of the application may not work as expected.",
"# {0} - maxMemory",
"Installer_checkMemoryAvailable_maxMemExpected_desc=Maximum JVM memory: {0}, is less than the 2 GB required. Some aspects of the application may not work as expected."
})
private void checkMemoryAvailable() {
try {
long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory
.getOperatingSystemMXBean()).getTotalMemorySize();
if (memorySize < 8_000_000_000L) {
String desc = Bundle.Installer_checkMemoryAvailable_physicalRamExpected_desc(
FileUtils.byteCountToDisplaySize(memorySize));
logger.log(Level.SEVERE, desc);
}
} catch (Throwable t) {
logger.log(Level.SEVERE, "There was an error fetching physical memory size", t);
}
try {
long maxMemory = Runtime.getRuntime().maxMemory();
if (maxMemory < 2_000_000_000L) {
String desc = Bundle.Installer_checkMemoryAvailable_maxMemExpected_desc(
FileUtils.byteCountToDisplaySize(maxMemory));
logger.log(Level.SEVERE, desc);
}
} catch (Throwable t) {
logger.log(Level.SEVERE, "There was an error fetching jvm max memory", t);
}
}
/**
* Initializes 7zip-java bindings. We are performing initialization once
* because we encountered issues related to file locking when initialization