Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve shutdown process #5905

Merged
merged 4 commits into from Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion common/src/main/java/bisq/common/ClockWatcher.java
Expand Up @@ -80,7 +80,9 @@ public void start() {
}

public void shutDown() {
timer.stop();
if (timer != null) {
timer.stop();
}
timer = null;
counter = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/app/BisqExecutable.java
Expand Up @@ -286,7 +286,7 @@ private void flushAndExit(ResultHandler resultHandler, int status) {
// If user tried to downgrade we do not write the persistable data to avoid data corruption
log.info("PersistenceManager flushAllDataToDiskAtShutdown started");
PersistenceManager.flushAllDataToDiskAtShutdown(() -> {
log.info("Graceful shutdown resulted in an error. Exiting now.");
log.info("Graceful shutdown completed. Exiting now.");
resultHandler.handleResult();
UserThread.runAfter(() -> System.exit(status), 100, TimeUnit.MILLISECONDS);
});
Expand Down
3 changes: 3 additions & 0 deletions p2p/src/main/java/bisq/network/p2p/network/Connection.java
Expand Up @@ -727,6 +727,9 @@ public void run() {
}

if (proto == null) {
if (stopped) {
return;
}
if (protoInputStream.read() == -1) {
log.warn("proto is null because protoInputStream.read()=-1 (EOF). That is expected if client got stopped without proper shutdown.");
} else {
Expand Down
Expand Up @@ -156,7 +156,6 @@ public void shutDown(@Nullable Runnable shutDownCompleteHandler) {
try {
tor = Tor.getDefault();
if (tor != null) {
log.info("Tor has been created already so we can shut it down.");
tor.shutdown();
tor = null;
log.info("Tor shutdown completed");
Expand Down