Skip to content

Conversation

@Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Apr 10, 2025

We've been bitten by this issue many times in the past: if a dependency upgrades to a newer Jandex than what Quarkus contains, build fails with an UnsupportedVersion exception.

This commit is a proper solution: if the exception is thrown, we swallow it and reindex the archive with the Jandex version that Quarkus incorporates.

Further, this commit increments the minimum Jandex version we "trust" from Jandex 2.1 to Jandex 3.0. We rely on new features from Jandex 2.4 and 3.0 on many places, so it makes sense to make 3.0 the new minimum. The changes added in 3.2 and 3.3 are also important, but are not used heavily yet.

@Ladicek Ladicek requested review from gastaldi and gsmet April 10, 2025 08:40

private static class MetaInfJandexReader implements Function<PathVisit, Index> {
private static MetaInfJandexReader instance;
private final String treeDescription;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because visit.getRoot() often returns just / (e.g. in case of a JAR from local Maven repo), so that's quite useless. PathTree.toString() is much more descriptive (e.g. in case of a JAR from local Maven repo, it returns the full path).

@Ladicek
Copy link
Contributor Author

Ladicek commented Apr 10, 2025

I think we would like to backport this to 3.20, but I'll leave the decision up to you :-)

Copy link
Contributor

@gastaldi gastaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, +1 to backport this to 3.20

@quarkus-bot

This comment has been minimized.

@gsmet
Copy link
Member

gsmet commented Apr 10, 2025

The tests are failing with:

Expecting empty but was: ["Reindexing %s:%s, at least Jandex 3.0 must be used to index an application dependency (index version is %s)",
    "Reindexing %s:%s, at least Jandex 3.0 must be used to index an application dependency (index version is %s)",
    "Reindexing %s:%s, at least Jandex 3.0 must be used to index an application dependency (index version is %s)",
    "Reindexing %s:%s, at least Jandex 3.0 must be used to index an application dependency (index version is %s)",
    "Reindexing %s:%s, at least Jandex 3.0 must be used to index an application dependency (index version is %s)"]

I think we have a couple of actions here:

  • wondering if the messages should include the parameters? - not sure if it's worth it, maybe it's just the toString() being conservative
  • we should probably exclude these messages for these tests
  • we need a list of the artifacts non indexed with Jandex 3+ and we need to fix them

@Ladicek
Copy link
Contributor Author

Ladicek commented Apr 10, 2025

  • wondering if the messages should include the parameters? - not sure if it's worth it, maybe it's just the toString() being conservative

The messages include the parameters, because interpolation happens further down the line.

  • we should probably exclude these messages for these tests

I've got a commit locally that does just that. Testing now if I've covered all tests.

  • we need a list of the artifacts non indexed with Jandex 3+ and we need to fix them

I think these PRs should fix this:

I'll check the log if there's more, just to be sure.

@gsmet
Copy link
Member

gsmet commented Apr 10, 2025

I see 4 messages, two are coming from the same project?

@Ladicek
Copy link
Contributor Author

Ladicek commented Apr 10, 2025

These are the messages I see in one randomly selected test:

2025-04-10T10:15:04.2459612Z 2025-04-10 10:15:04,118 WARN  [io.qua.dep.index] (build-17) Reindexing /home/runner/.m2/repository/io/smallrye/common/smallrye-common-annotation/2.11.0/smallrye-common-annotation-2.11.0.jar:/META-INF/jandex.idx, at least Jandex 3.0 must be used to index an application dependency (index version is 10)
2025-04-10T10:15:04.2462815Z 2025-04-10 10:15:04,129 WARN  [io.qua.dep.index] (build-17) Reindexing /home/runner/.m2/repository/io/smallrye/smallrye-context-propagation-storage/2.2.0/smallrye-context-propagation-storage-2.2.0.jar:/META-INF/jandex.idx, at least Jandex 3.0 must be used to index an application dependency (index version is 10)
2025-04-10T10:15:04.2466251Z 2025-04-10 10:15:04,130 WARN  [io.qua.dep.index] (build-17) Reindexing /home/runner/.m2/repository/io/smallrye/reactive/smallrye-reactive-converter-api/3.0.1/smallrye-reactive-converter-api-3.0.1.jar:/META-INF/jandex.idx, at least Jandex 3.0 must be used to index an application dependency (index version is 10)
2025-04-10T10:15:04.2468939Z 2025-04-10 10:15:04,130 WARN  [io.qua.dep.index] (build-17) Reindexing /home/runner/.m2/repository/io/smallrye/reactive/smallrye-reactive-converter-mutiny/3.0.1/smallrye-reactive-converter-mutiny-3.0.1.jar:/META-INF/jandex.idx, at least Jandex 3.0 must be used to index an application dependency (index version is 10)
2025-04-10T10:15:04.2471537Z 2025-04-10 10:15:04,139 WARN  [io.qua.dep.index] (build-17) Reindexing /home/runner/.m2/repository/io/smallrye/common/smallrye-common-vertx-context/2.11.0/smallrye-common-vertx-context-2.11.0.jar:/META-INF/jandex.idx, at least Jandex 3.0 must be used to index an application dependency (index version is 10)

These are all from the 3 projects I linked above.

@gastaldi
Copy link
Contributor

Perhaps we can remove the :/META-INF/jandex.idx from the logs, as we know they won't change

@Ladicek
Copy link
Contributor Author

Ladicek commented Apr 10, 2025

Good point @gastaldi, will do!

}
return reader.read();
} catch (UnsupportedVersion e) {
log.warnf("Reindexing %s, the index is too new (%s)", file, e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that excited about the message. Maybe ..., the index format of %s is too new for the Jandex version used by your application. Please report it to the author of this jar..

Or similar. The problem is about the index format, not the index and we should really avoid cryptic messages. And also, we should be clear that it's something to fix at the library level, not in your app.

The last part might be something to include in the previous message too.

Feel free to improve the wording, it's just to give a general direction.

Obviously, if we adjust things here, we need to do the same below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to improve this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

We've been bitten by this issue many times in the past: if a dependency
upgrades to a newer Jandex than what Quarkus contains, build fails
with an `UnsupportedVersion` exception.

This commit is a proper solution: if the exception is thrown, we swallow it
and reindex the archive with the Jandex version that Quarkus incorporates.

Further, this commit increments the minimum Jandex version we "trust" from
Jandex 2.1 to Jandex 3.0. We rely on new features from Jandex 2.4 and 3.0
on many places, so it makes sense to make 3.0 the new minimum. The changes
added in 3.2 and 3.3 are also important, but are not used heavily yet.
@Ladicek Ladicek force-pushed the jandex-auto-reindexing branch from 649f8c4 to 97572fa Compare April 10, 2025 13:54
@quarkus-bot quarkus-bot bot added the area/hibernate-orm Hibernate ORM label Apr 10, 2025
@gsmet gsmet added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Apr 10, 2025
@gsmet
Copy link
Member

gsmet commented Apr 10, 2025

@Ladicek it would be nice if we could have releases for the jars mentioned above before we push 3.22 so that we avoid reindexing every time we build an application.

@Ladicek
Copy link
Contributor Author

Ladicek commented Apr 10, 2025

That should be doable.

@quarkus-bot
Copy link

quarkus-bot bot commented Apr 10, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 97572fa.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging/deployment

io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector - History

  • Expecting actual: ["-6","-7","-8","-10","-11","-12","-13","-14"] to start with: ["-6", "-7", "-8", "-9"] - java.lang.AssertionError
java.lang.AssertionError: 

Expecting actual:
  ["-6","-7","-8","-10","-11","-12","-13","-14"]
to start with:
  ["-6", "-7", "-8", "-9"]

	at io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector(ConnectorChangeTest.java:41)

⚙️ JVM Integration Tests - JDK 17

📦 integration-tests/opentelemetry-grpc-only

io.quarkus.it.opentelemetry.grpc.HelloGrpcClientTest.testHello - History

  • java.lang.RuntimeException: Failed to start quarkus - java.lang.RuntimeException
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:682)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:780)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)

@gsmet gsmet merged commit 7517f7e into quarkusio:main Apr 10, 2025
56 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.22 - main milestone Apr 10, 2025
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Apr 10, 2025
@Ladicek Ladicek deleted the jandex-auto-reindexing branch April 11, 2025 06:35
@gsmet gsmet modified the milestones: 3.22 - main, 3.21.3 Apr 15, 2025
@jmartisk jmartisk modified the milestones: 3.21.3, 3.20.1 May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants