mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-2265 - Fixed printing of buffer exception when closing program; added
code for exception being printed in rare timing condition in tables
This commit is contained in:
@@ -90,7 +90,9 @@ public class DecompilerDataTypeReferenceFinder implements DataTypeReferenceFinde
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt(); // reset the flag
|
||||
Msg.debug(this, "Interrupted while decompiling functions");
|
||||
if (!monitor.isCancelled()) {
|
||||
Msg.debug(this, "Interrupted while decompiling functions");
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Msg.error(this, "Encountered an exception decompiling functions", e);
|
||||
|
||||
@@ -136,7 +136,7 @@ public class BufferMgr {
|
||||
private static final int INITIAL_BUFFER_TABLE_SIZE = 1024;
|
||||
|
||||
/**
|
||||
* An optional pre-cache of all buffers can be performed within a separate
|
||||
* An optional pre-cache of all buffers can be performed within a separate
|
||||
* thread if enabled.
|
||||
*/
|
||||
private enum PreCacheStatus {
|
||||
@@ -257,7 +257,7 @@ public class BufferMgr {
|
||||
|
||||
/**
|
||||
* Enable and start source buffer file pre-cache if appropriate.
|
||||
* This may be forced for all use cases by setting the System property
|
||||
* This may be forced for all use cases by setting the System property
|
||||
* db.always.precache=true
|
||||
* WARNING! EXPERIMENTAL !!!
|
||||
*/
|
||||
@@ -384,13 +384,13 @@ public class BufferMgr {
|
||||
public void dispose() {
|
||||
dispose(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dispose of all buffer manager resources including any source
|
||||
* buffer file.
|
||||
* This method should be called when this buffer manager instance
|
||||
* is no longer needed.
|
||||
* @param keepRecoveryData true if existing snapshot recovery files
|
||||
* @param keepRecoveryData true if existing snapshot recovery files
|
||||
* should not be deleted.
|
||||
*/
|
||||
public void dispose(boolean keepRecoveryData) {
|
||||
@@ -689,7 +689,7 @@ public class BufferMgr {
|
||||
|
||||
/**
|
||||
* Start pre-cache of source file if appropriate.
|
||||
* This targets remote buffer file adapters only.
|
||||
* This targets remote buffer file adapters only.
|
||||
*/
|
||||
private void startPreCacheIfNeeded() {
|
||||
if (preCacheThread != null) {
|
||||
@@ -729,7 +729,7 @@ public class BufferMgr {
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-cache source file into cache file. This is intended to be run in a
|
||||
* Pre-cache source file into cache file. This is intended to be run in a
|
||||
* dedicated thread when the source file is remote.
|
||||
*/
|
||||
private void preCacheSourceFile() throws IOException {
|
||||
@@ -1038,6 +1038,12 @@ public class BufferMgr {
|
||||
*/
|
||||
private void handleCorruptionException(Exception exception, String errorText)
|
||||
throws IOException {
|
||||
|
||||
if (exception instanceof ClosedException) {
|
||||
// not a corruption exception, but rather it can happen when closing the database
|
||||
throw (IOException) exception;
|
||||
}
|
||||
|
||||
Msg.error(this, errorText, exception);
|
||||
corruptedState = true;
|
||||
if (exception instanceof IOException) {
|
||||
@@ -1651,8 +1657,7 @@ public class BufferMgr {
|
||||
monitor.checkCanceled();
|
||||
if (index >= origIndexCount) {
|
||||
// Newly allocated free buffer
|
||||
BufferNode node =
|
||||
createNewBufferNode(index, currentCheckpointHead, null);
|
||||
BufferNode node = createNewBufferNode(index, currentCheckpointHead, null);
|
||||
node.isDirty = true;
|
||||
node.modified = true;
|
||||
node.empty = true;
|
||||
|
||||
@@ -61,9 +61,8 @@ public class IncrementalLoadJob<ROW_OBJECT> extends Job implements ThreadedTable
|
||||
doExecute(monitor);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
// InterruptedException handled via notification below
|
||||
if (!hasCause(e, InterruptedException.class)) {
|
||||
if (!hasCause(e, InterruptedException.class) && !monitor.isCancelled()) {
|
||||
// TODO: is there a better way to handle exceptions? If we don't grab it and show
|
||||
// it here, then it will be handled by the Worker, which just prints it to the
|
||||
// console. Plus, handling it here gives us a chance to notify that the process is
|
||||
@@ -136,8 +135,7 @@ public class IncrementalLoadJob<ROW_OBJECT> extends Job implements ThreadedTable
|
||||
// -A block on jobDone() can now complete as we release the lock
|
||||
// -jobDone() will notify listeners in an invokeLater(), which puts it behind ours
|
||||
//
|
||||
Swing.runLater(
|
||||
() -> updateManager.addThreadedTableListener(IncrementalLoadJob.this));
|
||||
Swing.runLater(() -> updateManager.addThreadedTableListener(IncrementalLoadJob.this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,12 +190,23 @@ public class IncrementalLoadJob<ROW_OBJECT> extends Job implements ThreadedTable
|
||||
private class IncrementalUpdatingAccumulator extends SynchronizedListAccumulator<ROW_OBJECT> {
|
||||
private volatile boolean cancelledOrDone;
|
||||
private Runnable runnable = () -> {
|
||||
|
||||
if (cancelledOrDone) {
|
||||
// this handles the case where a cancel request came in off the Swing
|
||||
// thread whilst we were already posted
|
||||
return;
|
||||
}
|
||||
updateManager.reloadSpecificData(asList());
|
||||
try {
|
||||
updateManager.reloadSpecificData(asList());
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
// note: check for cancelled again, as it may have been called after the initial
|
||||
// check above if the cancel call was requested off the Swing thread.
|
||||
if (!cancelledOrDone) {
|
||||
Msg.error(this, "Exception incrementally loading table data", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private SwingUpdateManager swingUpdateManager =
|
||||
|
||||
Reference in New Issue
Block a user