On Wed, 10 Jun 2026 12:45:28 GMT, Kevin Rushforth <[email protected]> wrote:

> This PR fixes a long-standing intermittent build failure on macOS (although 
> it could have hit any platform, we never saw it on Windows or Linux). The 
> problem was a race condition in the custom Groovy CCTask used by gradle to 
> compile native C / C++ code. A set of C/C++ command line options is passed in 
> to the custom CCTask and in the case of C++ files, mutated (to remove an 
> unwanted option). The bug is that the original list, which is passed in to 
> each invocation of CCTask is mutated rather than making a copy and mutating 
> that. When compilation tasks are run in parallel (which they are by default), 
> this can lead to the exception if one thread mutates the list while another 
> thread reads the list.
> 
> Even without the concurrency error, mutating the input list of options 
> directly is wrong, and should never have been done. The fix is to make a copy 
> of the input args and operate on the copy.
> 
> I was able to provoke this bug on my local system by creating a few extra 
> dummy files in the native-font directory and then running `gradle 
> cleanNativeFont; gradle :graphics:ccMacFont` in a loop. Without the fix it 
> fails for me after about 10-30 iterations. With the fix, I've run > 100 and 
> still running.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

@arapte Can you be the second reviewer?

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2186#issuecomment-4672460338

Reply via email to