Skip to content

Commit

Permalink
DX-90092 Log exceptions when closing BaseAllocator. (#70)
Browse files Browse the repository at this point in the history
* Added logging for exceptions

* DX-90092 Log exceptions when closing BaseAllocator.
  • Loading branch information
lriggs authored May 1, 2024
1 parent 333e3e3 commit 0721d67
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,20 @@ public AllocationReservation newReservation() {

@Override
public synchronized void close() {
try {
closeImpl();
} catch (Exception e) {
logger.warn(
"BufferAllocator.close() of {} got an exception {} - Details {}",
this,
e,
this.toVerboseString());

throw e;
}
}

private synchronized void closeImpl() {
/*
* Some owners may close more than once because of complex cleanup and shutdown
* procedures.
Expand Down Expand Up @@ -474,6 +488,7 @@ public synchronized void close() {
String msg = String.format("Memory was leaked by query. Memory leaked: (%d)\n%s%s", allocated,
outstandingChildAllocators.toString(), toString());
logger.error(msg);

throw new IllegalStateException(msg);
}

Expand All @@ -489,8 +504,6 @@ public synchronized void close() {
historicalLog.recordEvent("closed");
logger.debug(String.format("closed allocator[%s].", name));
}


}

@Override
Expand Down

0 comments on commit 0721d67

Please sign in to comment.