Skip to content

Conversation

@guoyuhong
Copy link

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
Author

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


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
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
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
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
Author

@pitrou Thanks!

pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
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.

Author: Yuhong Guo <[email protected]>

Closes apache#3682 from guoyuhong/removeCheckFromJNI and squashes the following commits:

3cbb4e3 <Yuhong Guo> Add Plasma Client Java test
52c52bd <Yuhong Guo> Avoid Crash in Plasma Java Client
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