Docker build WARMUP behaviour

Hi everyone,

We’ve been migrating our Docker builds to use Lucee 7’s native build-time warmup (LUCEE_ENABLE_WARMUP=true) combined with Server.cfc:onBuild() (introduced in LDEV-4922
) to pre-cache Maven dependencies declared in javaSettings / mavenLoad().

We build our own Tomcat container starting from stock Apache Tomcat and downloading lucee-light-7.0.5.41.jar directly. We noticed an interesting lifecycle behavior:

Steps to reproduce:

Fresh container with Tomcat and lucee-light-7.0.5.41.jar in lucee/ (no existing /opt/lucee/server/lucee-server/ state on disk).
Place Server.cfc at /opt/lucee/server/lucee-server/context/context/Server.cfc containing an onBuild() function.
Run Tomcat with LUCEE_ENABLE_WARMUP=true /usr/local/tomcat/bin/catalina.sh run.
Observation:

On the first run, the lucee-light bootstrap loader contacts download.lucee.org, downloads 7.0.5.41.lco, unzips bundles, and terminates. Server.cfc:onBuild() is never invoked.
On a second consecutive run (LUCEE_ENABLE_WARMUP=true catalina.sh run), 7.0.5.41.lco is now already present on disk. The engine starts up, triggers CFMLEngineImpl$OnStart, and Server.cfc:onBuild() executes cleanly.
Why this happens: On a cold filesystem with lucee-light, the loader is responsible for fetching the .lco patch. Because the core engine is not yet present at initial startup, the full CFML engine lifecycle (which initializes PageContext and dispatches onBuild()) does not run on pass 1 before the warmup exit hook shuts down Felix.

Question / Suggestion: For users authoring slim containers with lucee-light.jar, is running a two-pass warmup in the Dockerfile the expected pattern, or should the lucee-light loader chain directly into the core engine startup once .lco extraction finishes during warmup?

Thanks!

Thanks for the clear write-up — agreed, this is a bug. With lucee-light, the first warmup pass only fetches the .lco and exits, so onBuild() never runs until a second start.

Tracked here: LDEV-6472

Until that’s fixed, workarounds are: run warmup twice in the Dockerfile, use the full lucee.jar instead of lucee-light, or pre-place the matching .lco so the first pass starts the engine.

@GianTschingt wanna take a crack at the fix for this one? :smiley: you already suggested an approach in the jira ticket

Thanks @philsw. I tracked this down: it isn’t the warmup itself. On a clean server directory, compiling Server.cfc failed because the base Component.cfc wasn’t deployed yet (LDEV-6481), and that error was silently swallowed, so onBuild() was skipped. The second pass worked because the base component was there by then. This is already fixed in 7.1.2.100+ and 7.0.6.10+, where a single warmup pass runs onBuild(). With LDEV-6472 we’ll also log such listener failures from now on, instead of hiding them.