JDK-8340564 : [macOS] Intermittent build failure in native font with parallel compilation
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: jfx24
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • Submitted: 2024-09-20
  • Updated: 2024-09-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx24Unresolved
Related Reports
Relates :  
Relates :  
Description
The following intermittent build failure in on macOS, while building the ':graphics:ccMacFont' task, was spotted in a couple recent CI build jobs:

> Task :graphics:ccMacFont FAILED
...
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':graphics:ccMacFont'.
> java.util.concurrent.ExecutionException

See the attached log file for the complete ':graphics:ccMacFont' portion of the build.

We recently re-enabled parallel compilation on macOS with the fix for JDK-8339505 by removing the workaround that forced NUM_COMPILE_THREAD to 1. 

Parallel compilation had been disabled on macOS due to JDK-8089417, but I recently closed that as "cannot reproduce", after running a fair amount of testing, and also because the code in question that got the error is no longer in our repo (and the macOS compiler has been updated to clang, although I think that's not relevant).

It appears that it does still happen, just in a different font module. Since we get no errors or warnings from the compiler, one possibility is that the bug lies in the JavaFX build scripts that implement the parallel compilation for the native code in the graphics module.
Comments
I added `gradle --stacktrace` to our CI build jobs to see if we could catch this failure. We did today, so I attached the log containing the gradle stack trace. This snippet of the stack trace suggests that there is very likely a problem with our custom Groovy logic in NativeCompileTask: Caused by: java.util.concurrent.ExecutionException: java.util.ConcurrentModificationException at java_util_concurrent_Future$get.call(Unknown Source) at NativeCompileTask$_compile_closure6.doCall$original(NativeCompileTask.groovy:162) at NativeCompileTask$_compile_closure6.doCall(NativeCompileTask.groovy) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at NativeCompileTask.compile(NativeCompileTask.groovy:162) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125) I'll look more closely next week.
28-09-2024

As I mentioned in the last paragraph of the Description: "Since we get no errors or warnings from the compiler, one possibility is that the bug lies in the JavaFX build scripts that implement the parallel compilation for the native code in the graphics module." That's my best guess (and it's no more than a guess) at this point, but I have no idea why the font code would trigger it. Grasping at straws here, our native font code is (dis)organized into a single directory with all source files for all platforms in the same dir, with ifdefs so that it only compiles on the platform it is intended for. This means that we are compiling some empty source files on each platform. Maybe this triggers some sort of odd failure mode or interaction with the build logic. The (ancient) build logic that implements the parallel compilation lives in: https://github.com/openjdk/jfx/blob/master/buildSrc/src/main/groovy/com/sun/javafx/gradle/NativeCompileTask.groovy#L143 and was added back in the gradle 1.4 days as a solution for doing native compilation of tasks in the graphics modules before gradle supported native tasks. If an easy fix can be found, I'll look into doing that. If not, I will look into a workaround of overriding NUM_COMPILE_THREADS just for the font module on macOS.
21-09-2024

[~jvos] Can you keep an eye out in your CI builds and see if you even run into this? For now this is just an annoyance, but I would like to get to the bottom of it at some point.
20-09-2024