Skip to content

Commit

Permalink
LDEV-5246 disabled controller System.GC() by default
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jan 11, 2025
1 parent fb11c28 commit 6c443a3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
28 changes: 15 additions & 13 deletions core/src/main/java/lucee/runtime/engine/Controler.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public final class Controler extends ParentThreasRefThread {
// private final ShutdownHook shutdownHook;
private ControllerState state;

private boolean poolValidate;
//private boolean poolValidate;
private boolean enableGC;

/**
* @param contextes
Expand All @@ -94,7 +95,8 @@ public Controler(ConfigServer configServer, Map contextes, int interval, Control
this.interval = interval;
this.state = state;
this.configServer = configServer;
this.poolValidate = Caster.toBooleanValue(SystemUtil.getSystemPropOrEnvVar("lucee.datasource.pool.validate", null), true);
//this.poolValidate = Caster.toBooleanValue(SystemUtil.getSystemPropOrEnvVar("lucee.datasource.pool.validate", null), true);
this.enableGC = Caster.toBooleanValue(SystemUtil.getSystemPropOrEnvVar("lucee.controller.gc", null), false);
// shutdownHook=new ShutdownHook(configServer);
// Runtime.getRuntime().addShutdownHook(shutdownHook);
}
Expand Down Expand Up @@ -276,17 +278,6 @@ private void control(CFMLFactoryImpl[] factories, boolean firstRun, Log log) {
}
}

// every 5 minutes
if (do5Minute) {
try {
System.gc();
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
if (log != null) log.error("controler", t);
}
}

for (int i = 0; i < factories.length; i++) {
control(factories[i], do10Seconds, doMinute, doHour, firstRun, log);
}
Expand All @@ -308,6 +299,17 @@ private void control(CFMLFactoryImpl[] factories, boolean firstRun, Log log) {
if (log != null) log.error("controler", e);
}
}

// every 5 minutes
if (this.enableGC && do5Minute) {
try {
System.gc();
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
if (log != null) log.error("controler", t);
}
}
}

private void control(CFMLFactoryImpl cfmlFactory, boolean do10Seconds, boolean doMinute, boolean doHour, boolean firstRun, Log log) {
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/resource/setting/sysprop-envvar.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
"envvar": "LUCEE_CONTROLLER_DISABLED",
"desc": ""
},
{
"sysprop": "lucee.controller.gc",
"envvar": "LUCEE_CONTROLLER_GC",
"desc": "Default false, previously Lucee always ran a System.GC() every 5 minutes, available since 6.2"
},
{
"sysprop": "lucee.library.tld",
"envvar": "LUCEE_LIBRARY_TLD",
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.279-SNAPSHOT"/>
<property name="version" value="6.2.0.280-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.279-SNAPSHOT</version>
<version>6.2.0.280-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 6c443a3

Please sign in to comment.