Skip to content

Commit

Permalink
Increase the network connection timeout and improve error message (#8894
Browse files Browse the repository at this point in the history
)

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).
  • Loading branch information
jakkarth committed Jun 12, 2022
1 parent 082e9cf commit e3b2ab2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e3b2ab2

Please sign in to comment.