FOUR-32497: [Octane] MEDIUM — Accumulating State "pmFunctions" - #8962
FOUR-32497: [Octane] MEDIUM — Accumulating State "pmFunctions"#8962rodriquelca wants to merge 1 commit into
Conversation
|
There was a problem hiding this comment.
The PR adds late-registration sync to ExpressionLanguage and tests, but does not resolve the Octane issue: FormalExpression::$pmFunctions remains a private static array.
Gap vs ticket: No reset lifecycle, no bounded registry, no Octane integration. The static property still persists across worker requests.
Issue with tests: test_pm_functions_do_not_accumulate_across_requests asserts persistence (assertArrayHasKey('customFn', ...)) — opposite of the leak the ticket targets.
On resetPmFunctions() in ResetRequestState:
- Non-Octane:
registerOctaneListeners()no-ops withoutRequestTerminated— no impact. - Octane: reset prevents accumulation, but the static +
registerPMFunctions()foreach implies worker-scoped registration. Clearing after each request breaks boot-time registration inServiceProvider::boot(). - Current regression surface: zero —
registerPMFunction()has no production callers.
Required before merge:
- Define API contract: worker-scoped (stateless callables) vs request-scoped.
- Implement accordingly:
- Worker-scoped → keep static, document stateless requirement, optional dedup by name (already keyed).
- Request-scoped → reset on
RequestTerminated+ re-register onRequestReceivedor boot listener.
- Replace persistence assertions with reset/re-registration tests tied to
ResetRequestState/RequestTerminated.
Keep the late-registration block in registerPMFunction() — it is orthogonal and valid.




Issue & Reproduction Steps
RegisterPMFunction()
only stored callables in the static array, but did not register them in the currentExpressionLanguage` instance. This meant:initFormalExpression()were not available for immediate evaluation.Solution
Modified
registerPMFunction()to perform dual registration:static::$pmFunctions(bounded registry for Octane persistence).$this->feelExpressionif theExpressionLanguageinstance exists.How to Test
un the dedicated Octane test suite:
Related Tickets & Packages
Code Review Checklist