Skip to content

Conversation

@JinwooHwang
Copy link
Contributor

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

@raboof
Copy link
Member

raboof commented Aug 16, 2025

:geode-core:spotlessJavaCheck is failing for this PR.

Can you explain the motivation for this change? Doesn't this test seem to succeed on the main branch?

@raboof
Copy link
Member

raboof commented Aug 16, 2025

Can you explain the motivation for this change?

Ah I guess this is to make it succeed on Azul

assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE), ObjectGraphSizer.size(new TestObject4()));
assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE) + roundup(OBJECT_SIZE + 4),
if (SystemUtils.isAzulJVM()) {
assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE + 8), ObjectGraphSizer.size(new TestObject4()));
Copy link
Member

Choose a reason for hiding this comment

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

This '+ 8' seems suspicious to me - doesn't this indicate that either OBJECT_SIZE, REFERENCE_SIZE or ObjectGraphSizer.size needs to be different on Azul?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The size is different on Azul and 8 had to be added.

Copy link
Member

Choose a reason for hiding this comment

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

but does it make sense to add it in the test? wouldn't it make more sense to add it to OBJECT_SIZE or REFERENCE_SIZE? Or is there something in the calculation that needs to be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We cannot change OBJECT_SIZE or REFERENCE_SIZE just for Azul because they are also used for other JVM implementations.

Copy link
Member

Choose a reason for hiding this comment

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

Right, but the initialization of those values could depend on SystemUtils.isAzulJVM(), right? And the fact that this test failed perhaps suggests it should?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you can see in lines 35-36, OBJECT_SIZE and REFERENCE_SIZE are consistent whether it's Azul or not: assertEquals(roundup(OBJECT_SIZE * 2 + REFERENCE_SIZE),
ObjectGraphSizer.size(new TestObject3(), true));
That's why we cannot change those for Azul.

@JinwooHwang JinwooHwang merged commit e82209b into apache:develop Aug 26, 2025
15 of 17 checks passed
@JinwooHwang JinwooHwang deleted the ObjectSizerJUnitTest branch August 26, 2025 21:46
@raboof
Copy link
Member

raboof commented Aug 26, 2025

Whoa, I get that you're eager to get contributions in, but self-merging when there's open review feedback is unexpected. Self-merging when there are no reviews is also not great. You could at least have asked for reviews on the PRs, on Slack or on the dev list.

@JinwooHwang
Copy link
Contributor Author

@raboof , I apologize for self-merging in this case — I realize now that it was not the right approach, particularly while there was still open feedback. The reason I proceeded was that I hadn’t received any feedback after my last comment, but I understand that I should have requested reviews more explicitly and waited. I truly appreciate the time and effort that goes into providing review feedback, and I’ll make sure to follow the proper process and reach out on Slack or the dev list before merging in the future. Please feel free to undo the merge if you find this is not the correct solution. Thank you for calling this out and helping me improve.

@raboof
Copy link
Member

raboof commented Aug 27, 2025

Thanks ;).

I won't revert the change, but I still don't find assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE + 8), ObjectGraphSizer.size(new TestObject4())); a meaningful assertion - it's clear that the size is roundup(OBJECT_SIZE + REFERENCE_SIZE + 8), but it's not clear why. Unless we can motivate why it really should be roundup(OBJECT_SIZE + REFERENCE_SIZE + 8) I think I'd have preferred to just wrap the assertions that don't hold on Azul in a if (!SystemUtils.isAzulJVM()) { without making statements about the azul scenario. OK for now though.

@JinwooHwang
Copy link
Contributor Author

Thank you very much for the thoughtful feedback, @raboof. I fully agree that the assertion roundup(OBJECT_SIZE + REFERENCE_SIZE + 8) does not clearly communicate why this should be the expected value, and in hindsight it does not provide sufficient motivation for the Azul JVM scenario.

I made an effort to investigate why Azul’s JVM behaves differently here, but unfortunately I have not been able to determine the underlying reason. Because of that, I must admit I am not entirely satisfied with the current solution, and I share your concern that it may not be the most appropriate long-term approach. Wrapping the assertions does indeed seem like a cleaner and less speculative direction, and I would be glad to revisit and refine this in a follow-up.

JinwooHwang added a commit that referenced this pull request Sep 3, 2025
* ObjectSizerJUnitTest

(cherry picked from commit e82209b)
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.

2 participants