mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-12-17 08:44:10 -05:00
log stack trace for unexpected polling errors
This commit is contained in:
parent
bb2704c390
commit
a09c3a2079
3 changed files with 14 additions and 6 deletions
|
|
@ -3319,10 +3319,10 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
||||||
} else {
|
} else {
|
||||||
boolean isWalletConnected = isWalletConnectedToDaemon();
|
boolean isWalletConnected = isWalletConnectedToDaemon();
|
||||||
if (wallet != null && !isShutDownStarted && isWalletConnected) {
|
if (wallet != null && !isShutDownStarted && isWalletConnected) {
|
||||||
if (e instanceof NullPointerException) {
|
if (isExpectedWalletError(e)) {
|
||||||
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection(), e);
|
|
||||||
} else {
|
|
||||||
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection());
|
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection());
|
||||||
|
} else {
|
||||||
|
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection(), e); // include stack trace for unexpected errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ public abstract class XmrWalletBase {
|
||||||
// constants
|
// constants
|
||||||
private static final int SYNC_TIMEOUT_SECONDS = 180;
|
private static final int SYNC_TIMEOUT_SECONDS = 180;
|
||||||
private static final String SYNC_TIMEOUT_MSG = "Sync timeout called";
|
private static final String SYNC_TIMEOUT_MSG = "Sync timeout called";
|
||||||
|
private static final String RECEIVED_ERROR_RESPONSE_MSG = "Received error response from RPC request";
|
||||||
private static final long SAVE_AFTER_ELAPSED_SECONDS = 300;
|
private static final long SAVE_AFTER_ELAPSED_SECONDS = 300;
|
||||||
private Object saveIntervalLock = new Object();
|
private Object saveIntervalLock = new Object();
|
||||||
protected long lastSaveTimeMs = 0;
|
protected long lastSaveTimeMs = 0;
|
||||||
|
|
@ -96,7 +97,7 @@ public abstract class XmrWalletBase {
|
||||||
future.cancel(true);
|
future.cancel(true);
|
||||||
throw new RuntimeException(SYNC_TIMEOUT_MSG, e);
|
throw new RuntimeException(SYNC_TIMEOUT_MSG, e);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
throw new RuntimeException("Sync failed", e.getCause());
|
throw new RuntimeException("Sync failed", e);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt(); // restore interrupt status
|
Thread.currentThread().interrupt(); // restore interrupt status
|
||||||
throw new RuntimeException("Sync was interrupted", e);
|
throw new RuntimeException("Sync was interrupted", e);
|
||||||
|
|
@ -281,4 +282,8 @@ public abstract class XmrWalletBase {
|
||||||
// update state
|
// update state
|
||||||
wasWalletSynced = true;
|
wasWalletSynced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isExpectedWalletError(Exception e) {
|
||||||
|
return e.getMessage() != null && e.getMessage().contains(RECEIVED_ERROR_RESPONSE_MSG); // TODO: why does this error happen "normally"?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2050,8 +2050,11 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
if (wallet == null || isShutDownStarted) return;
|
if (wallet == null || isShutDownStarted) return;
|
||||||
if (HavenoUtils.isUnresponsive(e)) forceRestartMainWallet();
|
if (HavenoUtils.isUnresponsive(e)) forceRestartMainWallet();
|
||||||
else if (isWalletConnectedToDaemon()) {
|
else if (isWalletConnectedToDaemon()) {
|
||||||
log.warn("Error polling main wallet, errorMessage={}. Monerod={}", e.getMessage(), getXmrConnectionService().getConnection());
|
if (isExpectedWalletError(e)) {
|
||||||
//e.printStackTrace();
|
log.warn("Error polling main wallet, errorMessage={}. Monerod={}", e.getMessage(), getXmrConnectionService().getConnection());
|
||||||
|
} else {
|
||||||
|
log.warn("Error polling main wallet, errorMessage={}. Monerod={}", e.getMessage(), getXmrConnectionService().getConnection(), e); // include stack trace for unexpected errors
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (pollInProgressSet) {
|
if (pollInProgressSet) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue