Skip to content

Conversation

@cjmctague
Copy link
Contributor

  • Expand overly broad Exceptions that are masking the true Exception
    in accumulo-core
  • Formatting and Fixing Unit Test

- Expand overly broad Exceptions that are masking the true Exception
  in accumulo-core
- Formatting and Fixing Unit Test
this.blockCacheManager.stop();
}
} catch (Exception e1) {
} catch (RuntimeException e1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This catch block could probably be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this.blockCacheManager.stop(); has the possibility to throw an UnsupportedOperationException so I can catch/throw that here to narrow it.

Copy link
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

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

I'm in favor of this... like a lot... but I'm curious: How/when should we determine that this multi-catch block should also include RTEs and when shouldn't they? (Similar question for "Error" types, when we catch "Throwable", but I think that answer is a little more clear, because generally, catching "Error" should be avoided entirely.)

} catch (RuntimeException e1) {
throw new RuntimeException(e1);
} catch (UnsupportedOperationException e1) {
throw new UnsupportedOperationException(e1);
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused by this. Why not just let e1 get thrown all the way through?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this what you meant? 51afbce

Copy link
Member

Choose a reason for hiding this comment

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

Or just don't catch it in the first place.

failedToAcquireLock();
}
} catch (Throwable e) {
} catch (KeeperException | InterruptedException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this catch should be narrowed because any unexpected runtime exception needs to be properly handled for zookeeper locks. We don't want to ignore an NPE and think the lock is held when it is not.

I worry about the correctness of this change because of possible issues like this. Narrowing could lead to handling runtime exceptions differently which in some case could cause bugs. Its hard to review all of the narrowing for correctness.

Copy link
Member

Choose a reason for hiding this comment

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

Could just do (KeeperException | InterruptedException | RuntimeException e). I still think there's merit in no longer catching Error and thinking we have any clue how to handle that case (especially with merely logging it).

Copy link
Contributor

@keith-turner keith-turner Apr 2, 2019

Choose a reason for hiding this comment

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

This code does more than log, it calls lockWatcher.unableToMonitorLockNode(e) letting an observer know that the state of the lock is now unknown. With ZK lock issues we do want to make the best possible effort to halt the process, even if we fail trying. It may make sense to catch Throwable in case, I don't know without further inspection of the code.

Copy link
Contributor

@keith-turner keith-turner left a comment

Choose a reason for hiding this comment

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

Was looking over this again before merging and changed my review. I am uncertain about merging this now because of the comment I made about changing behavior of handling runtime exceptions.

@ctubbsii ctubbsii changed the base branch from master to 2.0 May 28, 2019 18:04
@milleruntime
Copy link
Contributor

@cjmctague I am removing the 2.0 label for this PR. If you want to make these changes for 2.1 that may be more appropriate.

@ctubbsii ctubbsii changed the base branch from 2.0 to master May 30, 2019 17:59
@ctubbsii
Copy link
Member

I think it would be great to revisit this, but with special care to avoid any behavior changes at all. It'd be easier to get these changes in if we didn't have to reconsider the kinds of things we are catching and how we are handling things.

After that is done, if there are follow-up changes that improve on the behavior changes, I think those would be easier to evaluate on their own.

@ctubbsii
Copy link
Member

ctubbsii commented Aug 5, 2020

This PR is quite out-of-date now. This should be rebased onto the main branch, or closed, and re-worked in a new PR.

@ctubbsii ctubbsii changed the base branch from master to main August 6, 2020 06:20
@cjmctague cjmctague closed this Oct 9, 2020
@cjmctague cjmctague deleted the accumulo-976 branch October 9, 2020 04:41
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.

4 participants