Skip to content

Conversation

@loiclefevre
Copy link
Collaborator

@loiclefevre loiclefevre commented Sep 19, 2025

This PR provides a fix for the Gradle Worker ID generation used for parallel testing; it indeed prevents "holes" in the sequence of generated IDs using a common file to synchronize all forked JVMs. As a result, there is no more possibility for 2 distinct JVMs to map onto the same targeted JDBC user.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19790

final ByteBuffer bb = ByteBuffer.allocate( Long.BYTES * maxParallelForks );
do {
try (FileLock lock = fc.lock( 0L, Long.MAX_VALUE, true )) {
final int bytesRead = fc.read( bb, 0 );

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'int bytesRead' is never read.
file.seek( length );
final ByteBuffer bb = ByteBuffer.allocate( Long.BYTES );
bb.asLongBuffer().put( new long[] {id} );
final int bytesWritten = fc.write( bb );

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'int bytesWritten' is never read.
@yrodiere yrodiere requested a review from beikov September 19, 2025 09:00
@sebersole
Copy link
Member

I'm not an expert and this level of Gradle parallelism, but this seems reasonable to me and causes no problems and @loiclefevre says it fixes the issues I see randomly on PR Actions.

If I hear no objections by tomorrow, going to apply it.

@beikov beikov merged commit 3086ccc into hibernate:main Sep 23, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants