[
https://issues.apache.org/jira/browse/OAK-12439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rishabh Daim updated OAK-12439:
-------------------------------
Description:
Repeated oak-run commands in one JVM can leave a Logback configuration scanner
running after shutdown. It can reload after oak.workDir is cleared and create
{{oak.workDir_IS_UNDEFINED/indexing.log}} outside the build directory, failing
RAT.
OAK-10339 exposed the issue in [commit
50bde7adad|https://github.com/apache/jackrabbit-oak/commit/50bde7adad3c8361447f5e06ce32413e8776d8e6]
by upgrading Logback 1.2.13 to 1.6.4. The new LoggerContext.stop() returns
immediately for an already-stopped context; LoggingInitializer reconfigured
that context without restarting it. This is independent of the cache changes.
Restart the context after successful configuration so shutdown closes appenders
and cancels scanners. Preserve the custom-configuration opt-out. Tests cover
repeated lifecycle cleanup, malformed configuration and isolation from shared
logging. Java 17 verification passes: 249 tests, one existing skip; packaging
and RAT pass.
[PR #3193|https://github.com/apache/jackrabbit-oak/pull/3193] · [Affected CI
run|https://github.com/apache/jackrabbit-oak/actions/runs/37422282668/job/112134394437]
was:
Repeated oak-run commands in one JVM leave Logback's configuration scanner
running after shutdown. The scanner can then create indexing.log under
oak.workDir_IS_UNDEFINED in the module directory, causing Apache RAT to fail.
h3. Cause
LoggingInitializer reconfigures a LoggerContext stopped by an earlier command
but does not restart it. With Logback 1.6.4, LoggerContext.stop() returns
immediately when the context is already stopped, leaving the new file appender
and scheduled configuration scanner active. When test-scoped system properties
are restored and a watched configuration changes or disappears, the scanner
reloads without oak.workDir and resolves the relative fallback directory.
h3. Reproduction
# Initialize indexing logging, then shut it down.
# Initialize it again in the same JVM. The context remains stopped although a
new scanner has been scheduled.
# Shut down again. The scheduled scanner is not cancelled.
# Restore/clear oak.workDir and modify the watched configuration. The exact
stray log is created outside target.
This was reproduced with the project's resolved Logback 1.6.4 dependencies,
independent of cache maintenance changes.
h3. Proposed fix and validation
Restart the reconfigured logging context so shutdown closes the appender and
cancels its scanner. Add deterministic regression tests for repeated
initialization/shutdown, retain the external-configuration opt-out, and verify
generated logging artifacts stay under test-scoped build output. Do not add RAT
exclusions for the stray log.
[Failing build on PR
3185|https://github.com/apache/jackrabbit-oak/actions/runs/37422282668/job/112134394437]
h3. Regression introduction (verified)
[Commit
50bde7adad3c8361447f5e06ce32413e8776d8e6|https://github.com/apache/jackrabbit-oak/commit/50bde7adad3c8361447f5e06ce32413e8776d8e6]
(OAK-10339, PR #1343, 29 September 2026) upgraded SLF4J 1.7.36 / Logback
1.2.13 to SLF4J 2.0.20 / Logback 1.6.4. LoggingInitializer itself is unchanged
across that commit.
Logback 1.2.13 LoggerContext.stop() unconditionally resets the context, closes
appenders and cancels scanning. Logback 1.6.4 returns immediately when the
context is stopped. Oak's second initialization configures a stopped context
but never starts it, exposing the missing lifecycle transition. This is
independent of the cache maintenance changes in PR #3185.
Controlled comparison using the same original Oak LoggingInitializer and two
init/shutdown cycles:
||Dependencies||Context started after second init||Scanner cancelled after
second shutdown||
|Logback 1.2.13 / SLF4J 1.7.36|false|true|
|Logback 1.6.4 / SLF4J 2.0.20|false|false|
|Logback 1.6.4 / SLF4J 2.0.20 with fix|true|true|
h3. Validation
Three regression tests fail before the production fix; all four new tests pass
afterwards. The Java 17 oak-run-commons unit suite passes: 247 tests, zero
failures/errors, one existing skip. Packaging and RAT pass with zero unapproved
files. Tests use unique work directories under target, check scanner
cancellation and file appender shutdown, and preserve the external
logback.configurationFile opt-out.
> Restart reconfigured oak-run logging contexts to stop orphaned scanners
> -----------------------------------------------------------------------
>
> Key: OAK-12439
> URL: https://issues.apache.org/jira/browse/OAK-12439
> Project: Jackrabbit Oak
> Issue Type: Bug
> Reporter: Rishabh Daim
> Assignee: Rishabh Daim
> Priority: Major
>
> Repeated oak-run commands in one JVM can leave a Logback configuration
> scanner running after shutdown. It can reload after oak.workDir is cleared
> and create {{oak.workDir_IS_UNDEFINED/indexing.log}} outside the build
> directory, failing RAT.
> OAK-10339 exposed the issue in [commit
> 50bde7adad|https://github.com/apache/jackrabbit-oak/commit/50bde7adad3c8361447f5e06ce32413e8776d8e6]
> by upgrading Logback 1.2.13 to 1.6.4. The new LoggerContext.stop() returns
> immediately for an already-stopped context; LoggingInitializer reconfigured
> that context without restarting it. This is independent of the cache changes.
> Restart the context after successful configuration so shutdown closes
> appenders and cancels scanners. Preserve the custom-configuration opt-out.
> Tests cover repeated lifecycle cleanup, malformed configuration and isolation
> from shared logging. Java 17 verification passes: 249 tests, one existing
> skip; packaging and RAT pass.
> [PR #3193|https://github.com/apache/jackrabbit-oak/pull/3193] · [Affected CI
> run|https://github.com/apache/jackrabbit-oak/actions/runs/37422282668/job/112134394437]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)