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

[Narayana] Make all Record class and BeanPopulator to init at runtime #40310

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhfeng
Copy link
Contributor

@zhfeng zhfeng commented Apr 26, 2024

revert #40250

cc @mmusgrov

@quarkus-bot quarkus-bot bot added the area/narayana Transactions / Narayana label Apr 26, 2024
Copy link

quarkus-bot bot commented Apr 26, 2024

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

@zhfeng
Copy link
Contributor Author

zhfeng commented Apr 26, 2024

@gastaldi it needs to backport to 3.8

Copy link
Contributor

@mmusgrov mmusgrov left a comment

Choose a reason for hiding this comment

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

I agree that the properties and classes need to be initialised at runtime. Thanks for the PR.

@@ -156,6 +170,11 @@ public void setProperties(NarayanaJtaRecorder recorder) {
defaultProperties.remove(i);
}
recorder.setDefaultProperties(defaultProperties);
// This must be done before setNodeName as the code in setNodeName will create a TSM based on the value of this property
Copy link
Contributor

@mmusgrov mmusgrov Apr 26, 2024

Choose a reason for hiding this comment

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

Remark: this code hasn't actually been added to the PR, it was already present and it's a quirk of github that it's showing up as added code.

@gastaldi gastaldi added triage/waiting-for-ci Ready to merge when CI successfully finishes and removed triage/backport-3.9 labels Apr 26, 2024
@zhfeng
Copy link
Contributor Author

zhfeng commented Apr 26, 2024

The hibernate-orm-panache is failing in native build and I will investigate.

This comment has been minimized.

@zhfeng
Copy link
Contributor Author

zhfeng commented Apr 26, 2024

@mmusgrov these three classes CAN NOT be added to initlize at runtime currently.

       runtimeInit.produce(new RuntimeInitializedClassBuildItem(UserTransactionImple.class.getName()));
       runtimeInit.produce(new RuntimeInitializedClassBuildItem(TransactionManagerImple.class.getName()));
       runtimeInit.produce(new RuntimeInitializedClassBuildItem(BaseTransaction.class.getName()));

It looks like hibernate-orm-panache has something to use TransactionManager at build time. I don't have much time to do further investigation right now. So maybe we can open a followup issue?

This comment has been minimized.

@zhfeng
Copy link
Contributor Author

zhfeng commented Apr 27, 2024

@gastaldi I think the reflection increase is expected.

@gsmet
Copy link
Member

gsmet commented Apr 29, 2024

@zhfeng that's a lot of increase for a lot of applications so we need a certainty here. I'm not entirely sure why we end up increasing this so much.

Maybe @zakkak can help us understand what's going on.

BTW, I would rather have the revert in a separate PR so that we revert right away. I don't want us to take the risk of having this patch released somehow.

@zhfeng
Copy link
Contributor Author

zhfeng commented Apr 29, 2024

Thanks @gsmet - I seperate revert commit in

Copy link

quarkus-bot bot commented Apr 29, 2024

Status for workflow Quarkus CI

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

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
Native Tests - Data5 Build Failures Logs Raw logs 🔍
Native Tests - Main Build Failures Logs Raw logs 🔍

Full information is available in the Build summary check run.
You can consult the Develocity build scans.

Failures

⚙️ Native Tests - Data5 #

- Failing: integration-tests/jpa-postgresql integration-tests/jpa-postgresql-withxml 

📦 integration-tests/jpa-postgresql

io.quarkus.it.jpa.postgresql.ImageMetricsITCase.verifyImageMetrics line 16 - History - More details - Source on GitHub

org.opentest4j.MultipleFailuresError: 
Multiple Failures (2 failures)
	org.opentest4j.AssertionFailedError: Expected analysis_results.methods.reflection to be within range [4367 +- 3%] but was 4663 ==> expected: <true> but was: <false>
	org.opentest4j.AssertionFailedError: Expected analysis_results.fields.reflection to be within range [201 +- 3%] but was 338 ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:80)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:58)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:3012)
	at io.quarkus.test.junit.nativeimage.NativeBuildOutputExtension.verifyImageMetrics(NativeBuildOutputExtension.java:59)

📦 integration-tests/jpa-postgresql-withxml

io.quarkus.it.jpa.postgresql.ImageMetricsITCase.verifyImageMetrics line 15 - History - More details - Source on GitHub

org.opentest4j.MultipleFailuresError: 
Multiple Failures (2 failures)
	org.opentest4j.AssertionFailedError: Expected analysis_results.methods.reflection to be within range [4551 +- 3%] but was 4845 ==> expected: <true> but was: <false>
	org.opentest4j.AssertionFailedError: Expected analysis_results.fields.reflection to be within range [170 +- 3%] but was 307 ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:80)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:58)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:3012)
	at io.quarkus.test.junit.nativeimage.NativeBuildOutputExtension.verifyImageMetrics(NativeBuildOutputExtension.java:59)

⚙️ Native Tests - Main #

- Failing: integration-tests/main 

📦 integration-tests/main

io.quarkus.it.main.ImageMetricsITCase.verifyImageMetrics line 15 - History - More details - Source on GitHub

org.opentest4j.MultipleFailuresError: 
Multiple Failures (1 failure)
	org.opentest4j.AssertionFailedError: Expected analysis_results.fields.reflection to be within range [496 +- 3%] but was 633 ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:80)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:58)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:3012)
	at io.quarkus.test.junit.nativeimage.NativeBuildOutputExtension.verifyImageMetrics(NativeBuildOutputExtension.java:59)
	at io.quarkus.test.junit.nativeimage.NativeBuildOutputExtension.verifyImageMetrics(NativeBuildOutputExtension.java:46)

Flaky tests - Develocity

⚙️ JVM Tests - JDK 17 Windows

📦 integration-tests/grpc-hibernate

com.example.grpc.hibernate.BlockingRawTest.shouldAdd - History

  • Condition with Lambda expression in com.example.grpc.hibernate.BlockingRawTestBase was not fulfilled within 30 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in com.example.grpc.hibernate.BlockingRawTestBase was not fulfilled within 30 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:975)
	at com.example.grpc.hibernate.BlockingRawTestBase.shouldAdd(BlockingRawTestBase.java:59)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)

@gsmet gsmet marked this pull request as draft April 30, 2024 11:38
@gsmet
Copy link
Member

gsmet commented Apr 30, 2024

We will discuss the merit of this PR later. For now we plan to fix the immediate issue with #40365

@gastaldi gastaldi removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label May 9, 2024
@gastaldi
Copy link
Contributor

gastaldi commented May 9, 2024

Is this PR still necessary?

@mmusgrov
Copy link
Contributor

Is this PR still necessary?

I don't think so but we need @zhfeng to decide.

@zhfeng
Copy link
Contributor Author

zhfeng commented May 10, 2024

For fixing #39283 , it is not needed. But if we still want to support system properties in the native mode, it is necessary.

@zakkak
Copy link
Contributor

zakkak commented May 14, 2024

Maybe @zakkak can help us understand what's going on.

I don't see anything special going on. Registering more classes for reflection is expected to increase these metrics.

With a quick count over the rest of the classes as well I get a total of 192 methods being added for reflection (which were not being added before).

Assuming that even before this PR the registered methods were close to the threshold if I subtract 192 from the reported numbers I see that the result is below the 3% threshold.

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.

6 participants