Skip to content

Flaky bare NullPointerException in model instantiation on Lucee 7 (cleared by reload) #3457

Closed

Description

@bpamiri

Summary

On Lucee 7.0.0.395 (the engine the Wheels CLI installs), the first model() call after a fresh boot — and intermittently afterwards — fails with a bare java.lang.NullPointerException with no Java stack, returning HTTP 500. ?reload=true clears it temporarily. Observed with both SQLite and H2 datasources, in plain wheels new scaffolds running current develop.

A variant of the same failure surfaces as:

Cannot invoke "lucee.runtime.component.Member.getAccess()" because the return
value of "java.util.Map$Entry.getValue()" is null

at lucee.runtime.ComponentImpl.keySet, reached via ComponentUtil.notFunction → onMissingMethod — Lucee enumerating a component whose member map contains a null entry.

Reproduction

  1. wheels new bench-perf
  2. Replace vendor/wheels with current develop.
  3. Add a model (app/models/Post.cfc extends="Model") and an action: for (i = 1; i <= 3000; i++) { model("Post").new(); }.
  4. First request after server start → 500 bare NPE (often at iteration 1). The same loop inside try/catch reports java.lang.NullPointerException with empty message and no detail.
  5. ?reload=true&password=... → the loop runs clean for a while; the failure can return on later requests.

Suspected cause

Issue #3236's integration-plan cache ($buildComponentIntegrationPlan / $integrateFunctions in vendor/wheels/global/objects.cfm and Model.cfc) pre-resolves method references from a shared holder component ({name, ref} pairs) and copies them into each new instance via variables[name] = ref; this[name] = ref;. If any ref resolves to Java null on Lucee 7 (holder method lookup during a cold class-cache), every materialized instance inherits a null member entry, and Lucee later NPEs while enumerating the component. The plan is cached in application.wheels.integrationPlans, which is why a reload (rebuilding the app scope) clears it.

Context

Found while benchmarking #3213 (Wheels 2.5 vs 4.x performance). The same rig runs cleanly on Wheels 4.0.3 (pre-#3236 code path) and on Wheels 2.5.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions