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

JavaCompile tasks may be in up-to-date state when modular dependencies have changed leading to odd runtime errors #12742

Closed
dweiss opened this issue Oct 31, 2023 · 3 comments · Fixed by #12745
Assignees
Labels
Milestone

Comments

@dweiss
Copy link
Contributor

dweiss commented Oct 31, 2023

Description

Recent builds failed with:

org.apache.lucene.search.uhighlight.TestLengthGoalBreakIterator > testTargetLen FAILED
    java.lang.NoSuchMethodError: 'org.apache.lucene.util.automaton.Automaton org.apache.lucene.util.automaton.Automata.makeStringUnion(java.util.Collection)'
        at __randomizedtesting.SeedInfo.seed([18019D3C4539B4C7:DBF0A37A952BEBF3]:0)
        at org.apache.lucene.search.uhighlight.CharArrayMatcher.fromTerms(CharArrayMatcher.java:42)
        at org.apache.lucene.search.uhighlight.MemoryIndexOffsetStrategy.buildCombinedAutomaton(MemoryIndexOffsetStrategy.java:71)
        at org.apache.lucene.search.uhighlight.MemoryIndexOffsetStrategy.<init>(MemoryIndexOffsetStrategy.java:53)

As Hoss noticed, there is a repro to get the above error:

It's actually pretty trivial to reproduce this problem locally...

git co 11436a848cbcc8302b31ca01e63e57dd35a93b1e
./gradlew clean classes testClasses
git co 361f0a4524d93fc1a793aa72bfcc91c00fa3599e
./gradlew test --tests TestFlattenGraphFilter

I'll try to figure out why this can happen, it shouldn't.

Version and environment details

No response

@dweiss dweiss self-assigned this Oct 31, 2023
@dweiss
Copy link
Contributor Author

dweiss commented Oct 31, 2023

It's not incremental compilation - it's something that is related to task inputs and (likely) modular dependencies. Seems like we're missing something that makes the test compilation task to be marked as up-to-date, even though its dependencies (core) have been recompiled.

I couldn't find the cause yet, but I'll keep digging.

@dweiss
Copy link
Contributor Author

dweiss commented Oct 31, 2023

I think the reason for an up-to-date status is because we handle module path ourselves

        // Add modular dependencies and their transitive dependencies to module path.
        task.options.compilerArgumentProviders.add(modularPaths.compilationArguments)

which means gradle can't inspect the contents of those dependencies (as it would with regular classpath entries).

I have to think how to handle this better. It's already hairy enough.

@dweiss dweiss changed the title gradle's incremental compilation can get confused and lead to odd build errors JavaCompile tasks may be in up-to-date state when modular dependencies have changed leading to odd runtime errors Nov 1, 2023
@dweiss dweiss added this to the 9.9.0 milestone Nov 1, 2023
@dweiss
Copy link
Contributor Author

dweiss commented Nov 1, 2023

I've provided a PR that fixes this. It is a corner case of us providing custom javac parameters (modular classpath). I am surprised this took so long to be discovered and I apologize - it's an oversight - we did have a dependsOn clause but it's different than task inputs (dependsOn is more of a task graph scheduling hint, inputs is a task status hint).

I've checked the PR by running Hoss's repro:

git co 11436a848cbcc8302b31ca01e63e57dd35a93b1e
./gradlew clean classes testClasses
git co [head of PR branch]
./gradlew test --tests TestFlattenGraphFilter

everything works and the code is recompiled as it should now.

dweiss added a commit that referenced this issue Nov 2, 2023
#12745)

Fix javac task inputs so that they include modular dependencies #12742
asfgit pushed a commit that referenced this issue Nov 2, 2023
#12745)

Fix javac task inputs so that they include modular dependencies #12742
rmuir pushed a commit to rmuir/lucene that referenced this issue Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant