From e3b2ab2264d184fafdf347d2ac3cca59b7b9c0f5 Mon Sep 17 00:00:00 2001 From: John Moore <39682+jakkarth@users.noreply.github.com> Date: Sun, 12 Jun 2022 07:10:14 -0400 Subject: [PATCH] Increase the network connection timeout and improve error message (#8894) In some instances, connecting to an existing JabRef instance may take longer than the original 200ms timeout. Here we increase that timeout to a full second. If it takes longer than that to connect to an existing instance, chances are something else bad is going on. Additionally, in a case where we attempt a ping but it fails for some reason, but we're also unable to bind the port to listen ourselves, we give the user a more informative error message about the potential cause of that problem, and offer two possible solutions: figure out what other process is already binding the port, or file a bug if that process happens to be JabRef (since that would indicate that a 1s timeout isn't sufficient). --- CHANGELOG.md | 1 + src/main/java/org/jabref/logic/remote/client/RemoteClient.java | 2 +- .../logic/remote/server/RemoteListenerServerLifecycle.java | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2f9fcc458..f0fb2cba24c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - The Medline/Pubmed search now also supports the [default fields and operators for searching](https://docs.jabref.org/collect/import-using-online-bibliographic-database#search-syntax). [forum#3554](https://discourse.jabref.org/t/native-pubmed-search/3354) - We improved group expansion arrow that prevent it from activating group when expanding or collapsing. [#7982](https://github.com/JabRef/jabref/issues/7982), [#3176](https://github.com/JabRef/jabref/issues/3176) - When configured SSL certificates changed, JabRef warns the user to restart to apply the configuration. +- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653) ### Fixed diff --git a/src/main/java/org/jabref/logic/remote/client/RemoteClient.java b/src/main/java/org/jabref/logic/remote/client/RemoteClient.java index 6942a902522..8090a73b9d5 100644 --- a/src/main/java/org/jabref/logic/remote/client/RemoteClient.java +++ b/src/main/java/org/jabref/logic/remote/client/RemoteClient.java @@ -18,7 +18,7 @@ public class RemoteClient { private static final Logger LOGGER = LoggerFactory.getLogger(RemoteClient.class); - private static final int TIMEOUT = 200; + private static final int TIMEOUT = 1000; private final int port; public RemoteClient(int port) { diff --git a/src/main/java/org/jabref/logic/remote/server/RemoteListenerServerLifecycle.java b/src/main/java/org/jabref/logic/remote/server/RemoteListenerServerLifecycle.java index 2f148bfdad4..e1ee48cbf75 100644 --- a/src/main/java/org/jabref/logic/remote/server/RemoteListenerServerLifecycle.java +++ b/src/main/java/org/jabref/logic/remote/server/RemoteListenerServerLifecycle.java @@ -43,7 +43,8 @@ public void open(MessageHandler messageHandler, int port, PreferencesService pre try { result = new RemoteListenerServerThread(messageHandler, port, preferencesService); } catch (BindException e) { - LOGGER.warn("Port is blocked", e); + LOGGER.warn("There was an error opening the configured network port {}. Please ensure there isn't another" + + " application already using that port.", port); result = null; } catch (IOException e) { result = null;