You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/08/16 19:58:50 UTC
[GitHub] eolivelli commented on a change in pull request #1608: Issue 1578:
Fixed deadlock in auditor blocking ZK thread
eolivelli commented on a change in pull request #1608: Issue 1578: Fixed deadlock in auditor blocking ZK thread
URL: https://github.com/apache/bookkeeper/pull/1608#discussion_r210723064
##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
##########
@@ -640,47 +641,51 @@ public void process(final Long ledgerId,
return;
}
- LedgerHandle lh = null;
- try {
- lh = admin.openLedgerNoRecovery(ledgerId);
- checker.checkLedger(lh,
- new ProcessLostFragmentsCb(lh, callback),
- conf.getAuditorLedgerVerificationPercentage());
- // we collect the following stats to get a measure of the
- // distribution of a single ledger within the bk cluster
- // the higher the number of fragments/bookies, the more distributed it is
- numFragmentsPerLedger.registerSuccessfulValue(lh.getNumFragments());
- numBookiesPerLedger.registerSuccessfulValue(lh.getNumBookies());
- numLedgersChecked.inc();
- } catch (BKException.BKNoSuchLedgerExistsException bknsle) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Ledger was deleted before we could check it", bknsle);
- }
- callback.processResult(BKException.Code.OK,
- null, null);
- return;
- } catch (BKException bke) {
- LOG.error("Couldn't open ledger " + ledgerId, bke);
- callback.processResult(BKException.Code.BookieHandleNotAvailableException,
- null, null);
- return;
- } catch (InterruptedException ie) {
- LOG.error("Interrupted opening ledger", ie);
- Thread.currentThread().interrupt();
- callback.processResult(BKException.Code.InterruptedException, null, null);
- return;
- } finally {
- if (lh != null) {
- try {
- lh.close();
- } catch (BKException bke) {
- LOG.warn("Couldn't close ledger " + ledgerId, bke);
- } catch (InterruptedException ie) {
- LOG.warn("Interrupted closing ledger " + ledgerId, ie);
- Thread.currentThread().interrupt();
+ // Do not perform blocking calls that involve making ZK calls from within the ZK
+ // event thread. Jump to background thread instead to avoid deadlock.
+ ForkJoinPool.commonPool().execute(() -> {
Review comment:
Don't we have some other threadpool available? If we have a Bookkeeper object (inside BK afmin) we could use its own main threadpool for instance
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services