java.lang.OutOfMemoryError: Java heap space - Ubooquity

Hi,

When importing books into Ubooquity, I noticed this error poping up a lot

“20220410 01:51:49 [Scanner thread] ERROR com.ubooquity.data.feeder.a - Failed to insert /mnt/Data/dietpi_userdata/ebooks/David McGriffy/Make_ Drones (646)/Make_ Drones - David McGriffy.pdf
java.lang.OutOfMemoryError: Java heap space”

Seems to happen a lot, but the books still get imported.

Pi 3B+

Thanks

I have “java.lang.OutOfMemoryError: Java heap space” messages in the logs

The quantity of memory allocated to Ubooquity depends on the hardware your are running it on. If this quantity is too small, you might sometime saturate it with when performing memory intensive operations. That’s when you get java.lang.OutOfMemoryError: Java heap space errors.

To fix the problem, you can explicitly set the amount of memory Ubooquity is allowed to use (be careful to set a value lower than the actual physical memory of your hardware).

The default value in DietPi for Ubooquity Java process is 768MB. You could raise this value to 1GB, but because you are using a RPi 3 which has only 1GB RAM available, you could make the system unresponsive if the java process needs the whole 1GB.

Different from the Ubooquity docs you had to do this in the config of the service, bc it’s started as a systemd service in DietPi.
So until the import of books is still working, I wouldn’t change anything :slight_smile:

theoretically you could increase SWAP file and enlarge the JAVA process as well. But as stated by Jappe this would slow down your system quite a lot.

I am also having these errors, running dietpi in a VM, and some books are not importing, and performance is sluggish.

Ubooquity system info shows the following:

Ubooquity version:	2.1.2 built on 2018-10-14 at 12:58
Java version:	17.0.2
Java vendor:	Debian
Java VM name:	OpenJDK 64-Bit Server VM
OS name:	Linux
OS version:	5.10.0-13-amd64
OS architecture:	amd64
Number of processors:	2
Max memory:	193 MB
Free memory:	92 MB
Total memory:	193 MB

Why is memory so low? How can I increase it?

At the moment, I have 1Gb attached to the VM, but I can increase it if necessary.

root@DietPi:/etc# free -h
               total        used        free      shared  buff/cache   available
Mem:           943Mi       558Mi        82Mi        27Mi       302Mi       222Mi
Swap:          1.5Gi       0.0Ki       1.5Gi

you would need to adjust the service file. There, the memory for the java process should be defined.

Something we could add to our docs. See the memory management tab for PaperMC about how it can be raised/defined: https://dietpi.com/docs/software/gaming/#papermc