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

IGNITE-23513 Use limited representation for arrays in BinaryObjectExImpl::toString #11610

Merged
merged 6 commits into from
Oct 28, 2024

Conversation

skorotkov
Copy link
Contributor

@skorotkov skorotkov commented Oct 22, 2024

BinaryObjectExImpl::toString shouldn't try to generate large strings for large arrays and respect the IGNITE_TO_STRING_COLLECTION_LIMIT property.

Otherwise errors like java.lang.OutOfMemoryError: Requested array size exceeds VM limit errors may occur.


Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email [email protected] or ask anу advice on http://asf.slack.com #ignite channel.

@skorotkov skorotkov marked this pull request as ready for review October 24, 2024 08:58
@@ -313,9 +320,16 @@ else if (val instanceof Object[]) {

appendValue(o, buf, ctx, handles);

if (i == COLLECTION_LIMIT - 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

            int len = Math.min(arr.length, COLLECTION_LIMIT);

            for (int i = 0; i < len; i++) {
                Object o = arr[i];

                appendValue(o, buf, ctx, handles);

                if (i < len - 1)
                    buf.a(", ");
            }

@@ -66,6 +69,10 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
*/
public abstract long offheapAddress();

/** */
private static final int COLLECTION_LIMIT =
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's reuse constant from GridToStringBuilder.

Copy link

@nizhikov nizhikov merged commit cb313f7 into apache:master Oct 28, 2024
8 checks passed
J-Bakuli pushed a commit to J-Bakuli/ignite that referenced this pull request Oct 28, 2024
luchnikovbsk pushed a commit to luchnikovbsk/ignite that referenced this pull request Jan 31, 2025
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