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

JabRef 5 on Linux x86_64 Extreme Memory Pressure, System Hangs, Unusable #5919

Closed
1 task done
PorcelainMouse opened this issue Feb 4, 2020 · 29 comments · Fixed by #6316
Closed
1 task done

JabRef 5 on Linux x86_64 Extreme Memory Pressure, System Hangs, Unusable #5919

PorcelainMouse opened this issue Feb 4, 2020 · 29 comments · Fixed by #6316

Comments

@PorcelainMouse
Copy link

JabRef version jabref-5.0.30388-1.x86_64 on

Steps to reproduce the behavior:

  1. start JabRef
  2. Watch Swap and Virt Mem
  3. Move the mouse around in front JabRef window when it has focus

What happens is that JabRef Virtual Memory size is 111 GB! And just interacting with the GUI causes a lot of memory to page out, causing some programs to crash. I was running vmstat at the time and it crashed while 2 GB of swap got used in about 30 seconds. Mouse starts jumping and then sound will lock up. Then, the whole computer locked up for about another 30 seconds.

This has happened every time I use JabRef 5 beta packages.

System is Fedora 31, Xorg.

@AEgit
Copy link

AEgit commented Feb 4, 2020

JabRef 5.0-beta.403--2020-02-03--0d42a87
Windows 10 10.0 amd64
Java 13.0.2

Cannot confirm for current dev version of JabRef on Windows. So this problem might be Linux-specific (?).

@AEgit
Copy link

AEgit commented Feb 4, 2020

Maybe the following issues are connected:

#5882
#5912

@PorcelainMouse
Copy link
Author

JabRef 5.0-beta.403--2020-02-03--0d42a87
Windows 10 10.0 amd64
Java 13.0.2

Cannot confirm for current dev version of JabRef on Windows. So this problem might be Linux-specific (?).

It is very likely Linux specific, but can you tell how big the VM is on Windows? That's my first question about that comparison.

In any case, you are probably using Oracle Java, and that is unlikely on Linux desktop systems. So, there are a lot of differences that need to be disentangled before any comparison is interpretable.

@PorcelainMouse
Copy link
Author

I guess the difference between this bug and the other two, is just that I don't notice the problem right away. I don't notice much delay until the memory issue starts pushing huge numbers of pages out of main memory. And, there is no way to guarantee this will not happen unless the binary is altered so that less that 100 GB of virtual memory is needed. I have actually built java monoliths before, but I still don't understand all of it.

@AEgit
Copy link

AEgit commented Feb 5, 2020

Hmm, does that mean, that you do not always encounter this bug? I can test this also with a Linux installation, but if it is not easy to reproduce it might get difficult. Is triggering the issue dependant on your database/database size?

@Siedlerchr
Copy link
Member

I updated some Java dependencies, could you please check the latest version from today? I'm just curious if it is better (

@wujastyk
Copy link

wujastyk commented Feb 5, 2020

JabRef 5.0-beta.406--2020-02-05--6fda10a
Linux 5.3.0-28-generic amd64
Java 13.0.2

Still a problem.

I don't understand why the "version" above says Java 13.0.2. Is that jre packaged in the deb file? My system has OpenJDK 8 and 11:

% update-java-alternatives -l
java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64

Update: no, slowness of keystrokes is not such a problem as formerly. It's just when it starts up, I think. The CPU usage on four CPUs goes up briefly to 80% or 100% on startup:

image

then after a minute or two, things calm down a little and keystrokes are normal speed. It's a clear improvement.

@PorcelainMouse
Copy link
Author

Hmm, I appreciate that CPU contention could cause slow downs, but that is not what I'm reporting here. At least I don't think it is, because I don't notice any CPU pressure. I'll try to get a graph, but for now, let's assume that is not this bug. My slowness is caused by swapping and memory exhaustion, but I have more than 2GB free when start jabref.

@PorcelainMouse
Copy link
Author

I'm also seeing this:

java.lang.IllegalStateException: Not on FX application thread; currentThread = pool-337-thread-1
	at org.jabref.merged.module/com.sun.javafx.tk.Toolkit.checkFxUserThread(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(Unknown Source)
	at org.jabref.merged.module/javafx.scene.Parent$3.onProposedChange(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.VetoableListDecorator.setAll(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.VetoableListDecorator.setAll(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.skin.LabeledSkinBase.updateChildren(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.skin.LabeledSkinBase.lambda$new$11(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler.lambda$new$1(Unknown Source)
	at org.jabref.merged.module/javafx.beans.value.WeakChangeListener.changed(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.markInvalid(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringProperty.setValue(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.Labeled.setText(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.skin.TabPaneSkin$TabHeaderSkin.lambda$new$2(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler.lambda$new$1(Unknown Source)
	at org.jabref.merged.module/javafx.beans.value.WeakChangeListener.changed(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.markInvalid(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.Tab.setText(Unknown Source)
	at org.jabref/org.jabref.gui.JabRefFrame.updateAllTabTitles(Unknown Source)
	at org.jabref/org.jabref.gui.exporter.SaveDatabaseAction.doSave(Unknown Source)
	at org.jabref/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
	at org.jabref/org.jabref.gui.dialogs.AutosaveUIManager.listen(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.jabref.merged.module/com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Unknown Source)
	at org.jabref.merged.module/com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Unknown Source)
	at org.jabref.merged.module/com.google.common.eventbus.Subscriber$1.run(Unknown Source)
	at org.jabref.merged.module/com.google.common.util.concurrent.DirectExecutor.execute(Unknown Source)
	at org.jabref.merged.module/com.google.common.eventbus.Subscriber.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Unknown Source)
	at org.jabref.merged.module/com.google.common.eventbus.EventBus.post(Unknown Source)
	at org.jabref/org.jabref.logic.autosaveandbackup.AutosaveManager.lambda$listen$0(Unknown Source)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

But, that is probably a different issue.

@wujastyk
Copy link

wujastyk commented Feb 5, 2020 via email

@PorcelainMouse
Copy link
Author

But, I'm working more carefully, now, and I need to amend some statements.

  1. It doesn't happen just moving the mouse around, that's just how I notice when it starts.
  2. It seems to be just a large memory footprint and, when I use the last free page, a huge amount of pages get swapped out at once and that is what cases the hang. So, it is definitely related to my used memory.
  3. but it seems to eat memory for no reason. If I leave it runnig, it ate another 1 GB while I wasn't even interacting with it.

I wonder if it's just too big. it uses about 3 times as much memory as my firefox, just when I start, now it's 8 times. All I did was create one new entry.

@PorcelainMouse
Copy link
Author

Okay, more details. I tried to finish entering the rest of that one entry and JabRef ate all of my remaining swap before I could finish. I had to quit it, but it's hung and has a bunch of memory locked.

Whatever this is, it's a memory issue. I don't know why JabRef is using so much memory, but it is way to much. It's 1.3 GB in of RAM used right now and it supposed to be quitting.

I don't know how to help troubleshoot this further, but I'm happy to help. Just let me know what I can do.

@Siedlerchr
Copy link
Member

JabRef ships with a packaged version of the JDK 13, a custom runtime image, which contains all necesary modules. If you want to run from code, you need to install a jdk 13.
@PorcelainMouse You could try to dig further in with the Java Profiler to locate the bottleneck,
https://www.yourkit.com/java/profiler/ (you can get a 15 days trial key)

@PorcelainMouse
Copy link
Author

I updated some Java dependencies, could you please check the latest version from today? I'm just curious if it is better (

Yes, I will check ASAP.

@PorcelainMouse
Copy link
Author

JabRef ships with a packaged version of the JDK 13, a custom runtime image, which contains all necesary modules. If you want to run from code, you need to install a jdk 13.

Ah, yes, right, that makes sense. I had trouble with the code for JabRef 5, so I was glad to find the rpm. Maybe I'll try the source if we cannot figure it out

@PorcelainMouse You could try to dig further in with the Java Profiler to locate the bottleneck,
https://www.yourkit.com/java/profiler/ (you can get a 15 days trial key)

Cool. Can I use the profiler on the packaged version or is that why you mentioned the code?

@PorcelainMouse
Copy link
Author

OMG, I tried the latest nightly build on Sunday and it almost crashed my computer. I have 16 GB of RAM and I don't know how much of that was free, but I had over 4 GB of free swap space and after less than 5 minutes running, I was able to run three passes of the Integrity Check tool on my .bib file and then my hole computer locked up swapping. The storage light was on solid for about 60 seconds and my mouse was completely stuck. It used up nearly all of the 4 GB free swap when it finally quit swapping. 4 GB!

Why is JabRef consuming huge amounts of memory? 4GB is 10 times the resident size of Firefox. Something is seriously wrong.

I'd love to help, but I don't know what I can do; I really cannot afford to be crashing my system every time I test. But, let me know what I can do and I'll try.

I think I will install Jab 5 on a VM, that way I can contain the damage.

@AEgit
Copy link

AEgit commented Feb 20, 2020

JabRef 5.0-beta.432--2020-02-19--c768697
Linux 5.3.0-40-generic amd64
Java 13.0.2

Cannot confirm with the current JabRef master on Ubuntu 18.04. I am using a database which contains nearly 20,000 entries. While I do experience performance problems (see here: #5071 and here: #5735), they are quite different from what you report. My database uses 3.2 GB of RAM on a virtual machine with just 4 GB of RAM - Swap remains untouched (just 268 KB used).

I do remember, however, that sometimes in the past, the same database would use up to 8 GB of RAM. It could be that this was a bug that has been fixed in the meantime, but my impression was that it depended on how you opened and interacted with the database. If you opened the database and immediately started clicking/interacting with it - without waiting for the entry preview to be fully loaded (#5735), then the RAM consumption would shoot up. Unfortunately, I was never able to replicate this behaviour in a consistent manner, so I never reported it.

Similarly, if I used a database which had been generated in an older version of JabRef 3.8.2 and not yet converted/saved with the new version 5.0, performance issues would also arise (see #5735 (comment)).

If none of these descriptions meet your problem, then maybe there is something going on with your database and/or Linux installation (?). If it is the latter, JabRef on a fresh VM installation might, indeed, shed light on this problem.

@wujastyk
Copy link

wujastyk commented Feb 20, 2020 via email

@PorcelainMouse
Copy link
Author

@AEgit thanks for trying to test; I'm thankful for the help.

However, I think you actually have confirmed this issue. What I'm seeing is lots of memory pressure, and you just confirmed that is what you saw. 3.2 GB is huge for resident memory! Remember FF is only 0.5 GB. Why would JabRef need 8 times that? My system is swapping because I'm actually using the rest of my memory for other programs. If you don't have other memory pressure, you will not swap and will not experience a slow down. But what I'm reporting is the memory use, the slowdown is just a side effect. (I didn't realize this when I opened the bug, but now I have more information.) If JabRef uses 4 GB of RAM, then that is not usable and I think it is a bug.

Also, I use an RPM distribution, fedora, so Ubuntu might not be a fair test. I don't know the build system, but I downloaded a completely different file for JabRef 5 than anyone who has Ubuntu. I realize that I didn't mention this, before, so I thought I should. I'm pretty sure this is not the problem, though.

Also, I have several "databases" open all the time, but the largest one is only 340 entries. So, I'm sure this has nothing to do with database size issue (#5735). Possibly multiple databases could be part of the issue, though, so let me know if you think that is significant.

I still plan to VM test this, though, so I'm not backing off that promise. My VMs do not have 4 GB, so I will likely experience host slowdowns even with JabRef in the VM, if this extreme memory size is indeed standard behavior. If it is something weird about my host system, then JabRef will not use 4 GB of memory in the VM.

Perhaps I can compare v4 to v5 in the VM, while I'm at it. I used 4 quite a bit before I upgraded to 5 pretty recently, and I don't remember these problems with it. So, IIRC, this is not just an unreasonable amount of memory being used by v5, but a huge increase relative to v4, which is more evidence for a bug.

@PorcelainMouse
Copy link
Author

A little more information. It's hard to compare apples to apples, but I checked Zotero w/ 500 database entries (very few have full text) and, on Linux, I see 320 MB resident / 2.2 GB virtual size, no swap used. On Windows, it reported less than 200 MB used for the same database. Not sure why windows seems to be more memory efficient, but whatever. The points stands: the memory JabRef is using is 10x bigger than what I would expect, all other things being equal.

I still haven't isolated this in my VM, but it will try it when I get a chance!

@bernhard-kleine
Copy link

bernhard-kleine commented Feb 28, 2020

I have noted some issues about releasing unused memory.
JabRef 5.0-beta.497--2020-02-27--3e0284d
Windows 10 10.0 amd64
Java 13.0.2

I have to two databases which when loaded occupy 1.2 Gbyte memory which with 16 Gb i can afford. However, after having loaded the second, 16000 entry library and selected all entries there were 3.2 Gb used. Closing the library did not free the memory. This is wasting memory and should be most probably addressed.
grafik

@ilippert
Copy link
Contributor

ilippert commented Mar 11, 2020

In case this is of interest: i have 10600 entries - without doing anything with it

JabRef 5.0--2020-03-08--93de138
Linux 5.5.8-200.fc31.x86_64 amd64
Java 13.0.2

I have memory use of 1,5GB, VirtualMemory 107,2GB, ResidentMemory 1,6GB, Shared Memory 200MB.

@PorcelainMouse
Copy link
Author

I still haven't tied it isolated, but that is seem less relevant as I learn more. I accidentally clicked the JabFox button, today, and JabRef started, again hanging my whole system for about a minute until 1.2 GB of memory was swapped out of RAM.

I looked at other processes running and found that JabRef is much larger than most, as I previously reported, but not the largest. Virtual size was 97 GB, but that was within 2 % of the next largest. Resident Mem was 1.2 GB, which matches the swapped out memory, but there was another process that was twice that.

So, I guess it is not really outside the realm of possibility. But, why? These other monster programs make some sense, and grow over time. When closed and reopened, they don't start up with this kind of pressure, I have to use them and they cache stuff. The only process with larger RES mem dropped to 255 MB after restart. That is why JabRef crushes my system, because it uses 1.2 GB on start. That part is still highly unusual.

There are basically only two other "big" programs to which I can compare JabRef. One is webkit2gtk, which is related to the browser, so I kind of get it, but, even after weeks of running the same instance, the RES size is <300 kB! So, it doesn't generate nearly the pressure that JabRef does, even though it's total size is the same. And the other really big VM process also has a tiny RES size, <90 kB, after weeks of running.

So, even compared to it's peers, JabRef is an outlier. I'm asking, can this be reduced, somehow? Why does JabRef load so much into memory at the beginning?

@wujastyk
Copy link

JabRef 5.1--2020-03-28--64e35c1
Linux 5.3.0-42-generic amd64
Java 14

Thinkpad T580, Core i5 8th gen, Linux Mint Cinnamon.

Here's what happens to my eight CPUs when I start JabRef:

image

@tobiasdiez
Copy link
Member

This bug may be fixed in the latest development version. Could you please check the build from http://builds.jabref.org/master/. Thanks! Please remember to make a backup of your library before trying-out this version.

@PorcelainMouse
Copy link
Author

Okay, cool. Thanks @tobiasdiez ! I'll try it soon.

@ilippert
Copy link
Contributor

JabRef 5.1--2020-04-21--dc1e339
Linux 5.5.16-200.fc31.x86_64 amd64
Java 14.0.1

It is awesome - I was able to run various operations at high speed (1-5 sec), that in the last test versions always took 20-40 seconds.

Memory 1,4gb
virtual memory 107,2gb
resident memory 1,6gb
shared memory 126mb

@wujastyk
Copy link

wujastyk commented Apr 22, 2020 via email

@PorcelainMouse
Copy link
Author

Okay, I finally got a chance to try the new build from master. I don't notice much speed difference; on my system, it looks about the same. This time when I tried it I had enough free memory to load it all on start. I see 112 GB virtual mem and 0.97 GB RSS. That's still huge, though it's about a 20 % improvement.

I didn't poke around much, but I added two new entries using JabFox, which is think is a pretty good use-case test. Memory usage after this is 1 GB, so about 20MB increase. That also seems like a crazy amount, but I don't know.

This is still much larger than I would expect. I don't know how to estimate the expected memory use for this application, other than by comparing it to other things, like Zotero, and that seems to show that JabRef is much less efficient. Only the developers could say if this is actually the expected memory usage or not, although even that may be difficult.

Anyway, if there is something I can do by way of testing, I'm happy to do that.

koppor pushed a commit that referenced this issue Apr 25, 2022
76b4268 Style for Acta Physica Sinica (物理学报) (#6009)
604de6f MLA Publication Date update (#5927)
41ce2d4 Update netherlands-journal-of-geosciences-geologie-en-mijnbouw.csl (#6027)
ad08f5d Adds space after title writing in ABNT style file (#6031)
0b5c1c2 Create CRCAO Light (#5935)
2f42b8c Create annals-of-laboratory-medicine.csl (#5959)
80a9506 Create annual-review-of-linguistics (#5992)
0fb9c40 Update the-journal-of-egyptian-archaeology.csl (#6028)
5ff53b1 Update guide-des-citations-references-et-abreviations-juridiques.csl (#6002)
c1c0212 Update society-for-american-archaeology.csl (#5919)
129ef3c Update administrative-science-quarterly.csl (#5991)
8bc22bd Create multilingual-matters.csl (#5955)
aca84fd Create expert-reviews-in-molecular-medicine.csl (#5961)
3c4ddc0 Create ethnobiology-letters.csl (#5986)
c301e04 Update heidelberg-university-faculty-of-medicine.csl (#5932)
a8c4396 Update tyndale-bulletin.csl (#5949)
c18cbcf Bluebook hotfix
d950b2b  Create incontext-studies-in-translation-and-interculturalism.csl (#5907)
7cfc106 Bump nokogiri from 1.13.2 to 1.13.4 (#6016)
0baa43a Liebert update (#6026)
41ca2b3 Bluebook Add space for ibid  (#6025)
6707a37 Update american-journal-of-botany.csl (#5954)
926fad5 Update boletin-de-pediatria.csl (#6024)

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 76b4268
Jonathan-Oliveira pushed a commit to Jonathan-Oliveira/jabref that referenced this issue May 7, 2022
76b4268 Style for Acta Physica Sinica (物理学报) (JabRef#6009)
604de6f MLA Publication Date update (JabRef#5927)
41ce2d4 Update netherlands-journal-of-geosciences-geologie-en-mijnbouw.csl (JabRef#6027)
ad08f5d Adds space after title writing in ABNT style file (JabRef#6031)
0b5c1c2 Create CRCAO Light (JabRef#5935)
2f42b8c Create annals-of-laboratory-medicine.csl (JabRef#5959)
80a9506 Create annual-review-of-linguistics (JabRef#5992)
0fb9c40 Update the-journal-of-egyptian-archaeology.csl (JabRef#6028)
5ff53b1 Update guide-des-citations-references-et-abreviations-juridiques.csl (JabRef#6002)
c1c0212 Update society-for-american-archaeology.csl (JabRef#5919)
129ef3c Update administrative-science-quarterly.csl (JabRef#5991)
8bc22bd Create multilingual-matters.csl (JabRef#5955)
aca84fd Create expert-reviews-in-molecular-medicine.csl (JabRef#5961)
3c4ddc0 Create ethnobiology-letters.csl (JabRef#5986)
c301e04 Update heidelberg-university-faculty-of-medicine.csl (JabRef#5932)
a8c4396 Update tyndale-bulletin.csl (JabRef#5949)
c18cbcf Bluebook hotfix
d950b2b  Create incontext-studies-in-translation-and-interculturalism.csl (JabRef#5907)
7cfc106 Bump nokogiri from 1.13.2 to 1.13.4 (JabRef#6016)
0baa43a Liebert update (JabRef#6026)
41ca2b3 Bluebook Add space for ibid  (JabRef#6025)
6707a37 Update american-journal-of-botany.csl (JabRef#5954)
926fad5 Update boletin-de-pediatria.csl (JabRef#6024)

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 76b4268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants