-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
JabRef opens multiple instances even when Remote operation is enabled #8653
Comments
I think I found the issue, at least I found a fix for me locally. Experimenting with various timeouts, A fix would be to either just bump the timeout to that or to make it configurable. Current code:
|
I'm not convinced a timeout is the issue here. The port is responsive for me in far less than 200ms:
As a side note, testing it that way results in a stack trace:
|
This is still an issue for me using JabRef 5.6--2022-04-25--5c9d898. |
Additional investigation of this issue has occurred at JabRef/JabRef-Browser-Extension#443. |
This issue is still occurring for me when using the latest development build I could find:
I can confirm that the port is still being opened:
Nevertheless, new executions from CLI still show |
This issue is beyond me, but having a look at the code and your description of the problem: Have you tried experimenting with different ports? If the issue persists with ports you know are NOT in usage by other programs, maybe JabRef detects its own listener on the port as "Address already in usage"? |
I've just tried it with 6052 just in case there was some weird magic going on. It did not make a difference. The output of the netstat command above is showing that JabRef is the one with the port open. Before opening the first JabRef instance and after closing the last one, the port is not in use. There's no other process trying to use that port. Can you point me in the code to where this functionality lives? Maybe I'll be able to spot something. I don't have the ability to compile the code and run it locally for debugging at the moment, but examining the code may yield clues. |
@jakkarth The code is located here https://github.com/JabRef/jabref/tree/main/src/main/java/org/jabref/logic/remote |
Thanks, this is interesting. At
To confirm that the port is in fact open by JabRef, I created the following test program (rename to .java). Obviously it's not using the JabRef protocol, but executing this creates the connection successfully to the first JabRef instance, and that instance outputs some errors when I send bad data, so it's definitely talking to the right process. |
Using wireshark, I've observed the traffic on the loopback address. When running my test program above, data is sent over the wire to the first JabRef instance. When launching a second JabRef instance, no data is sent. Based on that, I don't believe that
|
Maybe the answer we get from the ping is not correct? |
I would expect to get error output if the response from the ping was received but not as expected:
|
If you have the ability to run JabRef under a debugger, and you can reproduce this scenario, I'd be really interested to see what the code flow is starting from
|
I can try to debug this later (having a mac here), if you want to debug this in an IDE just follow our guide for setting up a workspace https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace.html |
I don't have enough free disk space to fit an IntelliJ install on this machine, so for the time being the best I can do is look at the repo on github and ask nicely :) |
I bought a new hard drive with more space and spent a few hours working through that document getting the environment set up. It took a lot of work, though some of that was because my machine started from a bad state. Anyway, I've replicated things as best I can while debugging the (second) instance of JabRef, and there is indeed a network timeout trying to connect to the first instance. I am at a loss to explain how it could possibly take longer than 0.2 seconds to establish a network connection to localhost. So, I can confirm #8653 (comment), but I'm at a loss to explain it. Increasing the timeout hasn't fixed the underlying problem, but has kept it from occurring on my machine. At this point I'm satisfied that the ping code is in fact executing, but I hate the unsolved mystery of why 0.2s isn't sufficient. I propose increasing the timeout to 1000 as @Siphalor suggested. I would also suggest catching the Now that I have a local environment where I can actually make those changes, I'd be happy to make a MR. Thoughts? |
Thanks for investigating this issue! We really appreciate this! Really a mystery. Could be that the JVM is taking some extra time until the connection is open. If increasing the timeout works, we should take that easy route! |
PR created. This is my first time contributing to this project. I read through the contribution guidelines and I think I got them all, but I'm happy to fix anything I missed. Your patience is appreciated :) |
JabRef version
Latest development branch build (please note build date below)
Operating system
GNU / Linux
Details on version and operating system
Linux Mint 20.1 MATE, JabRef 5.6--2022-04-04--dbf921e
Checked with the latest development build
Steps to reproduce the behaviour
netstat -lpnt |grep 6050
confirm that the port is properly opened by the java processExpected behavior: based on the documentation saying "Binding to this port makes it possible for a second JabRef instance to discover that the first one is running. In this case, unless specifically instructed to run in stand-alone mode, the second JabRef instance will pass its command line options through the port to the first JabRef instance, and then immediately quit." (emphasis added).
Actual behavior: When importing from the browser extension, a new instance of JabRef is opened and stays open. When launched from a console,
WARN: Port is blocked: java.net.BindException: Address already in use
is shown in the console of the second JabRef instance, and the application opens and stays open.Appendix
...
Log File
The text was updated successfully, but these errors were encountered: