Skip to content

Commit

Permalink
Merge pull request #961 from AdoptOpenJDK/console_memory_leak
Browse files Browse the repository at this point in the history
Console memory leak
  • Loading branch information
sclassen authored Nov 22, 2024
2 parents d841424 + d0ad1ee commit 742c4e4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,11 @@ DPEnableJnlpContentLogging=Log JNLP file content
DPEnableJnlpContentLoggingHint=When this switch is on, the content of the JNLP file(s) is logged.
DPEnableFile=Enable logging to file
DPEnableLegacyFileLog=Use java.util.logging instead of direct file writing
DPEnableClientAppFileLogging=Fork client applications outputs also to file
DPEnableLegacyFileLogHint=java.util.logging is known to deadlock rarely when used on applications with custom logging extensions
DPEnableClientAppFileLogging=Fork client application''s outputs also to file
DPEnableClientAppFileLoggingHint=Logging of client apps is known to sometimes not work with java.util.logging on
DPEnableClientAppConsoleLogging=Log client application''s outputs to console
DPEnableClientAppConsoleLoggingHint=Logging of client application''s to console. May lead to memory leak in console if the application output's large volume of text.
DPEnableLegacyFileLogHint=java.util.logging is known to deadlock rarely when used on applications with custom logging extensions
CPFilesLogsDestDir=File logs directory
CPFilesLogsDestDirResert=Reset to default
DPEnableFileHint=output messages will be saved to file in your {0} directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class DebuggingPanel extends NamedBorderPanel implements ItemListener {
ConfigurationConstants.KEY_ENABLE_LOGGING_TOFILE,
ConfigurationConstants.KEY_ENABLE_LEGACY_LOGBASEDFILELOG,
ConfigurationConstants.KEY_ENABLE_APPLICATION_LOGGING_TOFILE,
ConfigurationConstants.KEY_ENABLE_APPLICATION_LOGGING_TOCONSOLE,
ConfigurationConstants.KEY_ENABLE_LOGGING_TOSTREAMS,
ConfigurationConstants.KEY_ENABLE_LOGGING_TOSYSTEMLOG

Expand Down Expand Up @@ -145,6 +146,7 @@ public void actionPerformed(ActionEvent e) {
new JCheckBox(Translator.R("DPEnableFile")),
new JCheckBox(Translator.R("DPEnableLegacyFileLog")),
new JCheckBox(Translator.R("DPEnableClientAppFileLogging")),
new JCheckBox(Translator.R("DPEnableClientAppConsoleLogging")),
new JCheckBox(Translator.R("DPEnableStds")),
new JCheckBox(Translator.R("DPEnableSyslog"))
};
Expand All @@ -164,6 +166,7 @@ public void actionPerformed(ActionEvent e) {
(Translator.R("DPEnableFileHint", LogConfig.getLogConfig().getIcedteaLogDir())),
(Translator.R("DPEnableLegacyFileLogHint")),
(Translator.R("DPEnableClientAppFileLoggingHint")),
(Translator.R("DPEnableClientAppConsoleLoggingHint")),
(Translator.R("DPEnableStdsHint")),
(Translator.R("DPEnableSyslogHint"))
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ public interface ConfigurationConstants {

String KEY_ENABLE_APPLICATION_LOGGING_TOFILE = "deployment.log.file.clientapp"; //also client app will log to its separate file

String KEY_ENABLE_APPLICATION_LOGGING_TOCONSOLE = "deployment.log.console.clientapp";

String KEY_ENABLE_LEGACY_LOGBASEDFILELOG = "deployment.log.file.legacylog";

String KEY_ENABLE_LOGGING_TOSTREAMS = "deployment.log.stdstreams";
Expand Down Expand Up @@ -306,4 +308,5 @@ public interface ConfigurationConstants {
String KEY_HTTPCONNECTION_CONNECT_TIMEOUT = "deployment.connection.connectTimeout";
String KEY_HTTPCONNECTION_READ_TIMEOUT = "deployment.connection.readTimeout";
String KEY_HTTPCONNECTION_REQUEST_INTERVAL = "deployment.connection.request.interval";

}
7 changes: 6 additions & 1 deletion core/src/main/java/net/sourceforge/jnlp/config/Defaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public class Defaults {
*/
Setting.createDefault(
ConfigurationConstants.KEY_CONSOLE_STARTUP_MODE,
ConfigurationConstants.CONSOLE_HIDE,
ConfigurationConstants.CONSOLE_DISABLE,
ValidatorFactory.createStringValidator(new String[]{
ConfigurationConstants.CONSOLE_DISABLE,
ConfigurationConstants.CONSOLE_HIDE,
Expand Down Expand Up @@ -384,6 +384,11 @@ public class Defaults {
String.valueOf(true),
ValidatorFactory.createBooleanValidator()
),
Setting.createDefault(
ConfigurationConstants.KEY_ENABLE_APPLICATION_LOGGING_TOCONSOLE,
String.valueOf(false),
ValidatorFactory.createBooleanValidator()
),
Setting.createDefault(
ConfigurationConstants.KEY_ENABLE_LEGACY_LOGBASEDFILELOG,
String.valueOf(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class LogConfig {
private final boolean enableHeaders;
private boolean logToFile;
private final boolean logClientAppToFile;
private final boolean logClientAppToConsole;
private boolean logToStreams;
private boolean logToSysLog;
private final boolean legacyLogaAsedFileLog;
Expand All @@ -69,7 +70,8 @@ private LogConfig() {
logToSysLog = Boolean.parseBoolean(config.getProperty(ConfigurationConstants.KEY_ENABLE_LOGGING_TOSYSTEMLOG));
legacyLogaAsedFileLog = Boolean.parseBoolean(config.getProperty(ConfigurationConstants.KEY_ENABLE_LEGACY_LOGBASEDFILELOG));
logClientAppToFile = Boolean.parseBoolean(config.getProperty(ConfigurationConstants.KEY_ENABLE_APPLICATION_LOGGING_TOFILE));

logClientAppToConsole = Boolean.parseBoolean(config.getProperty(ConfigurationConstants.KEY_ENABLE_APPLICATION_LOGGING_TOCONSOLE));

// Get log directory, create it if it doesn't exist. If unable to create and doesn't exist, don't log.
icedteaLogDir = PathsAndFiles.LOG_DIR.getFullPath();
if (icedteaLogDir != null) {
Expand Down Expand Up @@ -110,6 +112,10 @@ public boolean isDebugEnable() {
return debugEnabled;
}

public boolean isLogClientAppToConsole() {
return logClientAppToConsole;
}

public boolean isLogToFile() {
return logToFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ private void consume() {

if (LogConfig.getLogConfig().isLogToConsole() && javaConsoleInitialized) {
//filtering is done in console during runtime
JavaConsole.getConsole().addMessage(message);
// log OWS/ITW output to console and App output only if the config property is set
if (message.getHeader().isClientApp == false || LogConfig.getLogConfig().isLogClientAppToConsole()) {
JavaConsole.getConsole().addMessage(message);
}
}

if (message.getHeader().isClientApp) {
Expand Down

0 comments on commit 742c4e4

Please sign in to comment.