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-4610: [Plasma] Avoid Crash in Plasma Java Client #3682

Closed
wants to merge 2 commits into from

Conversation

guoyuhong
Copy link
Contributor

This PR removes all ARROW_CHECK from the JNI code to avoid Java client from crashing. The Java client will throw exception instead. For one thing, it is better to throw exceptions from the lower part and let the upper user to decide how to handle it. For another, JVM should not crash at all times and there are a lot of JVM core dump files when we are doing some failover tests by killing Plasma Server.

@guoyuhong guoyuhong changed the title Avoid Crash in Plasma Java Client ARROW-4610: [Plasma] Avoid Crash in Plasma Java Client Feb 18, 2019
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.

could you please add a test too..

@guoyuhong
Copy link
Contributor Author

@praveenbingo Thanks. I have added the test. The test output is: Expected PlasmaClientException: org.apache.arrow.plasma.exceptions.PlasmaClientException: Encountered unexpected EOF.

@@ -205,7 +206,32 @@ public void doTest() {
assert !pLink.contains(id6);
System.out.println("Plasma java client delete test success.");

cleanup();
// Test calling shuntdown while getting the object.
Thread thread = new Thread(() -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

for my understanding..is there any reason to call this in a separate thread..can we just call using cleanup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we call cleanup directly, the socket is closed normally. There will be no exception as expected. This exception happens while client is waiting the reply from the server and at this time the server is killed or crashed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, is this test is not susceptible on timing issues then? for e.g. if the read returns before the server cleanup command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if the read returns before the server cleanup command, this test will fail. However, I used a none-existent object id in the get function and the function timeout is 3 seconds to guarantee that this test will pass.

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.

+1
Thanks for doing this @guoyuhong

@praveenbingo
Copy link
Contributor

@pcmoritz can you please help merge this.

@guoyuhong
Copy link
Contributor Author

@pitrou Could you help to merge this?

inline void throw_exception_if_not_OK(JNIEnv* env, const arrow::Status& status) {
if (!status.ok()) {
jclass Exception =
env->FindClass("org/apache/arrow/plasma/exceptions/PlasmaClientException");
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we would raise different exceptions based on the status error category. I guess this is good enough for now.

@pitrou
Copy link
Member

pitrou commented Feb 20, 2019

@guoyuhong Will do.

@pitrou pitrou closed this in b228489 Feb 20, 2019
@guoyuhong
Copy link
Contributor Author

@pitrou Thanks!

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.

3 participants