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-4236: [java] Distinct plasma client create exceptions #3306

Closed

Conversation

bibabolynn
Copy link

when ray puts an object in plasma store, there are 2 exceptions may be thrown, one is "An object with this ID already exists in the plasma store" and the other is "The plasma store ran out of memory and could not create this object", distinct them rather than let them both be the same java class

@raulchen please help review

"The plasma store ran out of memory and could not create this object.");
jclass Exception = env->FindClass(
"org/apache/arrow/plasma/exceptions/PlasmaOutOfMemoryException");
env->ThrowNew(Exception, oid.hex().c_str());
Copy link

Choose a reason for hiding this comment

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

PlasmaOutOfMemoryException doesn't take object id as the parameter.


public void put(byte[] objectId, byte[] value, byte[] metadata)
throws DuplicateObjectException, PlasmaOutOfMemoryException {
ByteBuffer buf = PlasmaClientJNI.create(threadConn.get(), objectId, value.length, metadata);
Copy link

Choose a reason for hiding this comment

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

what is threadConn?

public class PlasmaOutOfMemoryException extends RuntimeException {

public PlasmaOutOfMemoryException () {
super("The plasma store ran out of memory and could not create object with ID.");
Copy link

Choose a reason for hiding this comment

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

remove and could not create object with ID

super("The plasma store ran out of memory and could not create object with ID.", t);
}

}
Copy link

Choose a reason for hiding this comment

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

new line

super("An object with ID " + objectId + " already exists in the plasma store.", t);
}

}
Copy link

Choose a reason for hiding this comment

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

new line

"An object with this ID already exists in the plasma store.");
jclass Exception = env->FindClass(
"org/apache/arrow/plasma/exceptions/DuplicateObjectException");
env->ThrowNew(Exception, oid.hex().c_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation looks off.. also exception? for name..


public void put(byte[] objectId, byte[] value, byte[] metadata)
throws DuplicateObjectException, PlasmaOutOfMemoryException {
ByteBuffer buf = PlasmaClientJNI.create(conn, objectId, value.length, metadata);
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks backward incompatible..earlier we were ignoring any exceptions while creating the buffer

which is why the test is failing here -

any reason to change the behavior?

Copy link

Choose a reason for hiding this comment

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

The reason is because it makes more sense to propagate the exception to user code, and let user decide what to do. E.g., when putting an object with existing ID, someone may want to silently ignore the error, someone may want to use a different ID, and someone may want to terminate the program. The decision should depends on application logic.

@bibabolynn
Copy link
Author

@praveenbingo could you help check the ci result. I can't see why it failed or does it have anything to do with my changes. I've tried several times, but they all failed.

@raulchen
Copy link

The CI failure should be unrelated. Because this PR only touches Java, but the failed tests are all Python.
@praveenbingo do you have any other questions about this PR?

Copy link
Contributor

@praveenbingo praveenbingo left a comment

Choose a reason for hiding this comment

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

also looks like the python tests are having core dumps..would you be able to run the python tests to see if they are caused by this change
(i am not an expert in plasma to comment authoritatively)

try {
pLink.put(id1, value1, null);
} catch (DuplicateObjectException e) {
System.out.println("Plasma java client put same object twice exception test success.");
Copy link
Contributor

Choose a reason for hiding this comment

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

do you also want to assert that an exception is thrown..

Copy link
Author

Choose a reason for hiding this comment

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

ok, I've added an assert. As for python tests, I've only changed java and jni files which won't have any influence on python code since python code won't reach these code in any cases. So I don't think ci failed because of my change

@wesm
Copy link
Member

wesm commented Jan 10, 2019

Can you please create a JIRA issue for this and update the PR title?

@guoyuhong
Copy link
Contributor

@bibabolynn bibabolynn changed the title distinct plasma client create exceptions ARROW-4236: [java] Distinct plasma client create exceptions Jan 11, 2019
@bibabolynn
Copy link
Author

@wesm I've asked somebody else to create the JIRA issue and paste the link above. Because I don't have authority. 'bibabolynn' is my account, maybe you can add me

Copy link
Contributor

@pcmoritz pcmoritz left a comment

Choose a reason for hiding this comment

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

The change looks good to me.

@pcmoritz
Copy link
Contributor

@bibabolynn @raulchen Are there any changes necessary in Ray for this?

@pcmoritz
Copy link
Contributor

@wesm I've asked somebody else to create the JIRA issue and paste the link above. Because I don't have authority. 'bibabolynn' is my account, maybe you can add me

I added you as contributor and assigned the Issue to you.

@bibabolynn
Copy link
Author

@bibabolynn @raulchen Are there any changes necessary in Ray for this?

yes, there are changes in ray related to this which I will deal with after this pr is merged. That ray pr depends on this pr

@bibabolynn
Copy link
Author

@wesm @pcmoritz @praveenbingo since this pr has already been approved, I wonder when will it be merged?

@raulchen
Copy link

@praveenbingo @wesm any other actions needed from our side?

@wesm
Copy link
Member

wesm commented Jan 24, 2019

@pcmoritz is also a committer so he can also merge patches. Can you please rebase to make sure the build is passing? We fixed a bunch of problems that were going on in CI a couple weeks ago

@praveenbingo
Copy link
Contributor

Change looks good to me too..

Please rebase to re-trigger and verify the tests and this should be good for merge, as @wesm said @pcmoritz can merge the change post the tests..

@raulchen
Copy link

All tests are passing. @pcmoritz could you help merge it when you have time? Thanks!

@kou
Copy link
Member

kou commented Jan 24, 2019

I re-run CI. Now, CI is green.

@pcmoritz
Copy link
Contributor

pcmoritz commented Jan 24, 2019

Yes, merging it, thanks for the contribution! Originally I left it open in case there are more comments.

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.

7 participants