← Challenges

Repository · challenges

Parallel kompile local test run loses PrivilegedBuildAssistantHolder while building a diagnostics

View on GitHub ↗

Parallel kompile local test run loses PrivilegedBuildAssistantHolder while building a diagnostics

Reported (UTC): 2026-07-16 12:20

Parallel kompile local test run loses PrivilegedBuildAssistantHolder while building a diagnostics artifact

What was being attempted: Run BuildTestServerService full local suite with scripts/test.bash --test . --log test_log_file.xml after a dependency-only BuildTestEmbedded pin bump.

What went wrong: 42/43 tests completed successfully, but sjvmDoesNotLeakOnRepeatedThreadAllocation failed before its assertions when its @file:WithArtifact buildtest.server.buildDiagnostics() rule ran concurrently with the suite. The exact root exception was: java.lang.IllegalStateException: PrivilegedBuildAssistantHolder instance should not be null, should have been set by trusted code prior to getInstance() being called, at kompile.executionenvironment.bridge.interfaces.PrivilegedBuildAssistantHolder.getInstance(PrivilegedBuildAssistantHolder.java:14), called by build.kotlin.jvm.JvmBuildRulesKt.buildSimpleKotlinMavenArtifact(JvmBuildRules.kt:1426). The failure propagated through PrivilegedBuildAssistant.visitMethodInsn and BuildscriptRunner as Build rule buildtest.server.buildDiagnostics() failed with exit code 1.

Impact: The standard local full-suite command reports a false red for an otherwise passing dependency-only change, obscuring whether application behavior regressed and forcing a targeted rerun.

Workaround used: Rebased again and ran scripts/test.bash --test sjvmDoesNotLeakOnRepeatedThreadAllocation --log test_log_sjvm.xml. The same test passed 1/1 in isolation, confirming the failure depends on concurrent full-suite build-rule evaluation.

Suggested durable fix: In kompile execution-environment/bridge ownership, make PrivilegedBuildAssistantHolder installation scoped and reliable for every concurrent build-rule execution JVM/thread, or eliminate the process-global nullable holder. Add a stress regression that concurrently evaluates multiple @file:WithArtifact build rules, including buildSimpleKotlinMavenArtifact, and asserts no invocation observes a null holder.


Production verification — 2026-07-17

Status: STILL EXISTS. Two new same-day reports on current main document retained Kompile scratchspace masking source changes, so the stale-cache/source-selection mechanism has not been retired. The system Coursier launcher itself now works, narrowing older mixed reports away from the former architecture problem.

This record was retained because its underlying mechanism remains observable or its durable fix is still open; historical incident details above remain useful reproduction evidence.