-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-4610: [Plasma] Avoid Crash in Plasma Java Client #3682
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.arrow.plasma.exceptions; | ||
|
|
||
| public class PlasmaClientException extends RuntimeException { | ||
|
|
||
| public PlasmaClientException(String message) { | ||
| super(message); | ||
| } | ||
|
|
||
| public PlasmaClientException(String message, Throwable t) { | ||
| super(message, t); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import java.util.stream.Collectors; | ||
|
|
||
| import org.apache.arrow.plasma.exceptions.DuplicateObjectException; | ||
| import org.apache.arrow.plasma.exceptions.PlasmaClientException; | ||
| import org.junit.Assert; | ||
|
|
||
| public class PlasmaClientTest { | ||
|
|
@@ -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(() -> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| try { | ||
| TimeUnit.SECONDS.sleep(1); | ||
| cleanup(); | ||
| } catch (InterruptedException e) { | ||
| throw new RuntimeException("Got InterruptedException when sleeping.", e); | ||
| } | ||
| }); | ||
| thread.start(); | ||
|
|
||
| try { | ||
| byte[] idNone = new byte[20]; | ||
| Arrays.fill(idNone, (byte)987); | ||
| pLink.get(idNone, timeoutMs, false); | ||
| Assert.fail("Fail to throw PlasmaClientException when get an object " + | ||
| "when object store shutdown."); | ||
| } catch (PlasmaClientException e) { | ||
| System.out.println(String.format("Expected PlasmaClientException: %s", e)); | ||
| } | ||
|
|
||
| try { | ||
| thread.join(); | ||
| } catch (Exception e) { | ||
| System.out.println(String.format("Excpetion caught: %s", e)); | ||
| } | ||
| System.out.println("All test success."); | ||
|
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
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.