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

ARROW-9536: [Java] Miss parameters in PlasmaOutOfMemoryException.java #7815

Closed

Conversation

offthewall123
Copy link
Contributor

Miss parameters in PlasmaOutOfMemoryException.java

@github-actions
Copy link

@offthewall123
Copy link
Contributor Author

@wesm Could you take a review?

Copy link
Contributor

@rymurr rymurr left a comment

Choose a reason for hiding this comment

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

We have lost the no-args constructor and we are swallowing a string. What was the goal of this change, is there a problem somewhere downstream?

@@ -22,11 +22,11 @@
*/
public class PlasmaOutOfMemoryException extends RuntimeException {

public PlasmaOutOfMemoryException() {
public PlasmaOutOfMemoryException(String message) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we pass the string somewhere? eg add it to the original message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc
Line 123
env->ThrowNew(exceptionClass, "");
Here passed an empty String.But There is no String arg in PlasmaOutOfMemoryException constructor.
And if we need to catch this exception, it would show java (Ljava/lang/String;Ljava/lang/String;I)V
So add a String arg in PlasmaOutOfMemoryException constructors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An unit test added, please take a review.
@rymurr

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for the clarity @offthewall123

I think it would be better to add new constructors to augment the existing one and to append/replace the String message to the internal message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reply. @rymurr
Yes, we can add a new constructor like public PlasmaOutOfMemoryException(String message) and keep the origin two.
But In plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc
line 123 env->ThrowNew(exceptionClass, ""); here just passed an empty String, and i searched seems no overloaded function like env->ThrowNew(exceptionClass) which not to pass a String arg.

If we replace String message to the internal message -> It's an empty String, i think we should keep the internal message super("The plasma store ran out of memory.");

If Add new constructors -> The origin two constructors are of no use.

So String message added here is just to adapt env->ThrowNew(exceptionClass, "");

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @offthewall123 My concern is that someone somewhere might be using those exceptions in other ways and we shouldn't break their code. I think something like super("The plasma store ran out of memory. " + message) will result in effectively no change from current behaviour but if someone does add more context to the exception then the user will know about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @rymurr, i got it. Added a new constuctor without breaking the origin two.Unit test passed also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rymurr Could take a review again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

super("The plasma store ran out of memory.");
}

public PlasmaOutOfMemoryException(Throwable t) {
public PlasmaOutOfMemoryException(String message, Throwable t) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor

@rymurr rymurr left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@offthewall123
Copy link
Contributor Author

LGTM

Hi @rymurr ,will you merge this PR?

ByteBuffer byteBuffer = client.create(objectId, 200000000, null);
client.seal(objectId);
} catch (PlasmaOutOfMemoryException e) {
System.out.println(String.format("Expected PlasmaOutOfMemoryException: %s", e));
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this have an assert?

Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity why isn't this entire class run as a unit or integration test? This currently isn't being run as part of any CI right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shouldn't this have an assert?

Hi @emkornfield , an Assert statement added.

@emkornfield
Copy link
Contributor

+1, thanks.

@offthewall123
Copy link
Contributor Author

+1, thanks.

Hi @emkornfield Why this PR is closed ? not merged?

@emkornfield
Copy link
Contributor

We use a script to merge PRs that squashes all commits and then merges the squashed commit closing the original PR. You can see the link to the new commit above

kszucs pushed a commit to kszucs/arrow that referenced this pull request Aug 11, 2020
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
kszucs pushed a commit to kszucs/arrow that referenced this pull request Aug 11, 2020
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
kszucs pushed a commit to kszucs/arrow that referenced this pull request Aug 12, 2020
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
kszucs pushed a commit to kszucs/arrow that referenced this pull request Aug 17, 2020
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
kszucs pushed a commit to kszucs/arrow that referenced this pull request Aug 17, 2020
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
Miss parameters in PlasmaOutOfMemoryException.java

Closes apache#7815 from offthewall123/miss_parameter_bug_fix

Authored-by: offthewall123 <dingyu.xu@intel.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
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.

None yet

3 participants