Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle (8.4, JDK 21) rewrite tasks hang indefinitely #234

Closed
mmoayyed opened this issue Oct 6, 2023 · 8 comments
Closed

Gradle (8.4, JDK 21) rewrite tasks hang indefinitely #234

mmoayyed opened this issue Oct 6, 2023 · 8 comments
Labels
bug Something isn't working question Further information is requested

Comments

@mmoayyed
Copy link

mmoayyed commented Oct 6, 2023

What version of OpenRewrite are you using?

I am using:

Gradle Plugin: 6.3.18
Gradle: 8.4
JDK: 21
MacOS Ventura 13.5.2

How are you running OpenRewrite?

./gradlew rewriteDryRun -DactiveRecipe=CASUpgrade6612 --no-configuration-cache --debug --no-parallel

Configuration:

rewrite {
    def activeRecipe = providers.systemProperty("activeRecipe").getOrNull()
    if (activeRecipe != null) {
        def file = project.getRootProject().file("openrewrite/${activeRecipe}.yml")
        def out = services.get(StyledTextOutputFactory).create("cas")
        out.withStyle(Style.Success).println("Activating recipe ${file}")
        configFile = file
    }
}

Recipe:

---
type: specs.openrewrite.org/v1beta/recipe
name: CASUpgrade6612
displayName: Upgrade the CAS to version 6.6.12
recipeList:
  - org.openrewrite.gradle.AddProperty:
      key: cas.version
      value: 6.6.12
      overwrite: true
      filePattern: 'gradle.properties'

What is the smallest, simplest way to reproduce the problem?

git clone --depth 1 git@github.com:apereo/cas-overlay-template.git
# With JDK 21
./gradlew rewriteDryRun -DactiveRecipe=CASUpgrade6612 --no-configuration-cache --debug --no-parallel

What did you expect to see?

The gradle.properties file changes its version to 6.6.12

What is the full stack trace of any errors you encountered?

Build hangs with (Gradle debug logs):

2023-10-06T18:46:49.514+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2023-10-06T18:46:49.514+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2023-10-06T18:46:49.514+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2023-10-06T18:46:49.514+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2023-10-06T18:46:49.514+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2023-10-06T18:46:49.514+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2023-10-06T18:46:59.518+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2023-10-06T18:46:59.518+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2023-10-06T18:46:59.519+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2023-10-06T18:46:59.519+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2023-10-06T18:46:59.519+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2023-10-06T18:46:59.519+0400 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

Tried this with all different versions of Gradle 8.4, from RC1 to proper GA.

Are you interested in contributing a fix to OpenRewrite?

With a bit of guidance, certainly.

@mmoayyed mmoayyed added the bug Something isn't working label Oct 6, 2023
@timtebeek
Copy link
Contributor

Hi @mmoayyed , good seeing you here! As far as I'm aware you're certainly one of the earlier ones trying out OpenRewrite on Java 21. Not quite sure that's supported yet; we're tracking support with some small blockers in

Would running on Java 17 for now be an option? And does that give any different results?

Note that you're also able to compose and run recipes quickly through the Moderne platform;
Using the recipe builder at https://app.moderne.io/recipes/builder you can for instance run against
https://app.moderne.io/organizations/apereo/java-cas-client?branch=master&origin=github.com

That way you should be able to quickly explore what changes a collection of recipes would make:
https://app.moderne.io/results/pXfDfkhLs/details/eyJfX3R5cGVuYW1lIjoiR2l0SHViUmVwb3NpdG9yeSIsIm9yaWdpbiI6ImdpdGh1Yi5jb20iLCJwYXRoIjoiYXBlcmVvL2phdmEtY2FzLWNsaWVudCIsImJyYW5jaCI6Im1hc3RlciJ9?referrer=%2Fresults%2FpXfDfkhLs
image

Hope that helps you iterate quicker, such that you're able to get up and running before distributing your own recipes.

@timtebeek timtebeek moved this to Backlog in OpenRewrite Oct 11, 2023
@timtebeek timtebeek added the question Further information is requested label Oct 11, 2023
@timtebeek timtebeek removed the status in OpenRewrite Oct 11, 2023
@mmoayyed
Copy link
Author

Thank you very much for the details and the screenshot. Much appreciated.

ATM, running on JDK 17 is no longer an option as the codebase/project I am primarily working on does require JDK 21. I will nonetheless give this a try once more with the Moderne platform and see if I may get better results.

Is there anything I can do to help out regarding JDK 21 support? Something to test, etc?

@timtebeek
Copy link
Contributor

Glad to hear I could help in some way; we expect any recipes that you compose or develop to work on Java 21 just as well, once we have parser support there, so you should already be able to develop recipes and try those on any Java 8 - 17 projects.

There's nothing related to Java 21 to test yet, but you can follow along to openrewrite/rewrite-migrate-java#305 to get updates as we work. Thanks for the offer to help! Really good to have feedback as we work. :)

@timtebeek
Copy link
Contributor

Quick note to let you know we've added a Java 21 specific parser to https://github.com/openrewrite/rewrite/tree/main/rewrite-java-21 ; Haven't tried it out on projects through the plugins yet, but there's progress towards support.

@mmoayyed
Copy link
Author

Very nice. Thank you for the update.

@timtebeek
Copy link
Contributor

Checking back in with some fresh perspective (for myself). It turns out Gradle 8.4 does not yet running on Java 21 itself; it does support building projects that themselves use Java 21 through toolchains; but Gradle itself needs to be launched with Java < 20.

Are you already using toolchains in your project?

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(21))
    }
}

Once Gradle 8.5 becomes available you should be able to use the Java 21 to run Gradle itself as well. I believe there's a 8.5 RC out that you can try to see if that resolves your issues. Do let us know if that means this issue can be closed!

@mmoayyed
Copy link
Author

mmoayyed commented Nov 29, 2023

Thank you. ATM I am running with Gradle 8.5 RC4 and OpenRewrite 6.5.9 and the issue is gone.

@timtebeek
Copy link
Contributor

Ah perfect, thanks for confirming! Good to know there's no issues coming up to 8.5 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
Archived in project
Development

No branches or pull requests

2 participants