Hi,
After upgrade to jmix 2.4, first update was in 06.11 morning, next after 6 hours, I seen more memory used by application:
Today crash the application used all free memory in 8 hour.
After restart service the application eat 22% from 20% (after start) to 44% (after 2 work hours), I have only 2 users, and 4G memory. Server without jmix application use only 400Mb.
Strange!?
Indeed strange dear Florin, but may I ask how do you start your application, what are your xms and xms sizes?
Hi Mladen,
I start my application using systemd service:
florin@server:~$ cat /etc/systemd/system/genedatabank.service
[Unit]
Description=GeneDataBank java server application
# depend by network and postgres
Wants=network-online.target postgresql.service
# start after network and postgres service start
After=network-online.target postgresql.service
[Service]
# run as user genedatabank (need to exist before)
User=genedatabank
# from group genedatabank (need to exist before)
Group=genedatabank
# restart always
Restart=always
# activation state
Type=simple
# working directory for user (in this case the home is /opt/genedatabank)
WorkingDirectory=/opt/genedatabank/
# execute command to start the application
ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java \
-jar /opt/genedatabank/genedatabank.jar \
--server.port=8090
# send stdout to syslog
StandardOutput=syslog
# send stderr to syslog
StandardError=syslog
# identifier for syslog
SyslogIdentifier=genedatabank
[Install]
WantedBy=multi-user.target
and now I restart the service, after this I check memory used by application:
florin@server:~$ sudo ps aux --sort=-%mem
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 1085624 0.0 16.3 4734464 687840 ? Ssl 07:42 1:28 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /opt/genedatabank/genedatabank.jar --server.port=8090
We see today how eat because the user number grow to 4.
With Cuba framework and Tomcat 8/9 I run application in the past on arm SBC with only 2G memory without problems.
How you can see I not using xms (initial memory allocation) or xmx (maximum memory allocation) flags.
Your purpose is to give something to xms and/or xmx? If yes, from your experiences, how amount of memory to allocate?
I have 4G allocated to my lxc server, my pc ( X86J4125864 v2) have 8G for all with Proxmox VE (with Ipfire (VM) and ubuntu server (LXC) started all the time).
LE> after 2 hours with 2/3 users, first process, so grow to 39% and with libreoffice user genedatabank eat 60%:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 1085624 0.0 39.0 4847148 1637692 ? Ssl 07:42 5:05 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /opt/genedatabank/genedatabank.jar --server.port=8090
genedat+ 1093682 0.0 5.3 1016292 223612 ? Sl 08:42 0:02 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8101 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;
genedat+ 1093332 0.0 5.2 1006460 220344 ? Sl 08:41 0:02 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8100 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;
genedat+ 1097013 0.0 5.2 1006460 218616 ? Sl 09:07 0:02 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8103 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8103,tcpNoDelay=1;urp;
genedat+ 1093966 0.0 5.2 1006464 218576 ? Sl 08:44 0:02 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8102 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8102,tcpNoDelay=1;urp;
grafana 14443 0.0 2.8 1598480 119892 ? Ssl nov06 20:38 /usr/share/grafana/bin/grafana server ...
prometh+ 455 0.0 2.2 1983744 95548 ? Ssl nov06 16:53 /usr/local/bin/prometheus ...
jvb 2503 0.0 1.5 5869920 65980 ? Ssl nov06 28:02 java -Xmx3072m -XX:+UseG1GC -XX: ...
jicofo 12045 0.0 1.4 5866788 62632 ? Sl nov06 19:39 java -Xmx3072m -XX:.....
postgres 373 0.0 0.8 223236 37140 ? Ss nov06 0:16 postgres: 16/main: checkpointer
root 1101681 0.0 0.8 291080 37104 ? Ss 09:38 0:00 /usr/sbin/apache2 -k start
LLE> with 4 users connected:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 1085624 0.0 46.6 4847148 1956200 ? Ssl 07:42 6:43 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /opt/genedatabank/genedatabank.jar --server.port=8090
genedat+ 1093682 0.0 5.5 1017564 234628 ? Sl 08:42 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8101 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;
genedat+ 1093966 0.0 5.3 1006464 223312 ? Sl 08:44 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8102 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8102,tcpNoDelay=1;urp;
genedat+ 1097013 0.0 5.3 1006460 222712 ? Sl 09:07 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8103 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8103,tcpNoDelay=1;urp;
genedat+ 1093332 0.0 5.3 1006460 222648 ? Sl 08:41 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8100 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;
so now used 68%, after approximate 3 hours. I see maximum 9 connection at postgresql:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
postgres 1106629 0.0 0.3 227256 15048 ? Ss 10:11 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(48912) idle
postgres 1106498 0.0 0.3 227256 14920 ? Ss 10:10 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(54204) idle
postgres 1106499 0.0 0.3 227256 14920 ? Ss 10:10 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(40696) idle
postgres 1106500 0.0 0.3 227256 14920 ? Ss 10:10 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(40712) idle
postgres 1106553 0.0 0.3 227256 14920 ? Ss 10:11 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(52304) idle
postgres 1106554 0.0 0.3 227256 14920 ? Ss 10:11 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(52306) idle
postgres 1106556 0.0 0.3 227256 14920 ? Ss 10:11 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(45198) idle
postgres 1106630 0.0 0.3 227256 14920 ? Ss 10:11 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(48926) idle
postgres 1106631 0.0 0.3 227256 14920 ? Ss 10:11 0:00 postgres: 16/main: svgenebank genedatabank 127.0.0.1(48940) idle
LLLE> after 4 hours with 5 users connected not grow very much:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 1085624 0.0 46.8 4847148 1964776 ? Ssl 07:42 7:24 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /opt/genedatabank/genedatabank.jar --server.port=8090
genedat+ 1093682 0.0 5.6 1017564 236164 ? Sl 08:42 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8101 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;
genedat+ 1093966 0.0 5.3 1006464 223312 ? Sl 08:44 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8102 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8102,tcpNoDelay=1;urp;
genedat+ 1097013 0.0 5.3 1006460 222712 ? Sl 09:07 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8103 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8103,tcpNoDelay=1;urp;
genedat+ 1093332 0.0 5.3 1006460 222648 ? Sl 08:41 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8100 -nologo -nod
efault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;
After 5 hours grow like bread, the same 5 users, not work very fast
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 1085624 0.0 58.9 4842904 2471296 ? Ssl 07:42 9:26 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /opt/genedatabank/genedatabank.jar --server.port=8090
genedat+ 1093332 0.0 5.6 1017716 237868 ? Sl 08:41 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8100 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;
genedat+ 1093682 0.0 5.6 1017564 236164 ? Sl 08:42 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8101 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;
genedat+ 1093966 0.0 5.3 1006464 223568 ? Sl 08:44 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8102 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8102,tcpNoDelay=1;urp;
genedat+ 1097013 0.0 5.3 1006460 223224 ? Sl 09:07 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8103 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8103,tcpNoDelay=1;urp;
grafana 14443 0.0 2.8 1598596 119744 ? Ssl nov06 21:07 /usr/share/grafana/bin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/run/grafana/grafana-server.pid --packaging=deb cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
postgres 1122133 0.0 2.3 288676 99060 ? Ss 12:07 0:05 postgres: 16/main: svgenebank genedatabank 127.0.0.1(56100) idle
After 7 hours, with 5 users conected:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 1085624 0.0 64.0 4842904 2688048 ? Ssl 07:42 15:03 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /opt/genedatabank/genedatabank.jar --server.port=8090
genedat+ 1093332 0.0 3.9 1017716 166828 ? Sl 08:41 0:05 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8100 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;
genedat+ 1093682 0.0 3.8 1017564 160260 ? Sl 08:42 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8101 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;
genedat+ 1093966 0.0 3.5 1006464 149328 ? Sl 08:44 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8102 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8102,tcpNoDelay=1;urp;
genedat+ 1097013 0.0 3.5 1006460 148856 ? Sl 09:07 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8103 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8103,tcpNoDelay=1;urp;
Tomorrow I start application with next flags -Xms1024m -Xmx2048m -XX:+UseG1GC -XX:+UseStringDeduplication
I think collect garbage
I usually try to leave 1G for the system.
Example on 8GB system I have application xmx 6G, and since I have JasperReports I left 2G for that and the system.
With 4, I would use Xmx of 3G, but you can experiment. Its important to allocate as much RAM as possible before the system starts using the swap partition.
It’s also important what your application does and how—do you create a lot of objects or load entire database tables into DTOs?
G1GC setting is good.
Kind regards,
Mladen
Thank you Mladen for your opinion.
Finally program blocked at 64,5% in 7,5 hours.
As I said, tomorrow I start with new flags to see how work.
Hi,
Good news, this time with new flags not crash but the memory is more used by application:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
genedat+ 642 0.0 66.7 4962372 2798084 ? Ssl 07:53 11:30 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar -Xms1024m -Xmx2048m -XX:+UseG1GC -XX:+UseStringDeduplication /opt/genedatabank/genedatabank.jar --server.port=8090
genedat+ 7415 0.0 4.3 1017468 182908 ? Sl 08:43 0:04 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8100 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;
genedat+ 8166 0.0 4.2 1015540 180220 ? Sl 08:47 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8102 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8102,tcpNoDelay=1;urp;
genedat+ 7864 0.0 4.1 1006464 174068 ? Sl 08:46 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8101 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;
genedat+ 8588 0.0 4.1 1006460 172768 ? Sl 08:50 0:03 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///opt/genedatabank/.jmix/temp/reporting.server_localhost_8103 -nologo -nodefault -norestore -nocrashreport -nolockcheck -nofirststartwizard -headless -accept=socket,host=localhost,port=8103,tcpNoDelay=1;urp;
What I learned is this Xms and Xmx is not minimum memory and maximum memory used by application.
Next time I used next flags -Xms512m -Xmx1024m -server -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp
More help https://www.baeldung.com/jvm-parameters
LE>
Hi,
For who need to know how many resources is used/managed by jvm exist a jconsole application.
I started this by root using ssh and X forwarding.
Maximum heap size is in parameters, tomorrow I try with 1024m.
LLE> Now the CPU is in use 100% by garbage collector GC. No one is connected to application.
Do you use Quartz scheduler addon, and or email addon?
No Mladen,
I found the exact time when problems arrived:
In 05.11 I stopped the service to make update for application at version 0.1.3 (this have jmix 2.3), in 06.11 I stopped to make update at version 0.1.4 (this have jmix 2.4) and then to 0.1.5 (also jmix 2.4), after this appear OutOfMemoryError
Now I prepared to capture heapdump error and I am curios to see where is the problem, if I can’t fix it then I revert to 0.1.3 in git and I start a new branch from this node and I will try to start the application again with jmix 2.3, I not know if jmix 2.4 add some flag/modification in database what make impossible to revert at jmix 2.3.
LE> My project is this GitHub - florintanasa/genedatabank: GeneDataBank is an genetic plant database.
Hi,
With /usr/lib/jvm/java-17-openjdk-amd64/bin/java -Xms512m -Xmx1024m -server -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heapdump.bin -jar /opt/genedatabank/genedatabank.jar --server.port=8090
after 4 hour and 40% load from memory give java.lang.OutOfMemoryError: Java heap space
but I load heapdump.bin file and I opening in MAT:
But I not understand something more, only the probably the leakage is the class io.jmix.flowui.data.binding.impl.HtmlContainerReadonlyDataBindingImpl
LE>
And this class exist another in top java.util.HashMap
Using Jmix 2.2.3 complex app with many addons, on 8G, Amazon Linux 2023 on EC2 instance, 2-3 users not doing much
free -m
TIME USED FREE BUFF/CACHE AVAILABLE
System restart after being stuck
11:35 3530 3875 524 4173
12:05 3557 3845 526 4145
13:44 3589 3801 539 4113
Application restart
15:00 2303 4769 857 5399
15:38 3383 3687 859 4319
17:22 4940 2122 867 2762
19:11 4953 2097 879 2749
19:44 4949 2098 881 2753
21:39 4953 2070 887 2737
22:38 4949 2070 890 2743
So I can see changes up and down, most likely as GC executes, but, buff/cache usage is growing steadily regardless of application restart, only system restart helps.
Then I moved the app to 16G instance 11 hour ago, buff cache started with 3008 now is 3024.
With CUBA 7.2 app, same 16G system lasts about 2 months.
Kind regards,
Mladen
Mladen, you using jar file or war in Tomcat for jmix application?
I use jar file.
Hi!
Looks like a memory leak in the io.jmix.flowui.data.binding.impl.HtmlContainerReadonlyDataBindingImpl
class.
As far as I can see, the map for component listener registrations is filled, but never cleared. This is obviously a bug.
Thank you for your vigilance and initial investigation. We will fix this bug in version 2.4.1 which will be released soon: HtmlContainerDataBinding memory leak · Issue #3877 · jmix-framework/jmix · GitHub
For now, to avoid leaks, you can manually remove the binding using the io.jmix.flowui.data.binding.impl.HtmlContainerReadonlyDataBindingImpl#unbind(com.vaadin.flow.component.HtmlContainer)
method in the controller that used the binding (for example, at the time of screen detaching).
Best regards,
Dmitriy
Thank you Dmitriy and Mladen,
Today I installed a useful tools https://atbswp.com/ and I put to do some clicks (I have a copy and edit in a form take it from here https://demo.jmix.io/ui-samples/sample/copy-action ) and I try to test some configuration with Xmx3G I can insert 600 records until OutOfMemory. With this and a restart to the service at the end of work day I can wait yours update in this moment.
LE>
@d.kremnev If help, after OutOfMemory I take it heapdump.bin file and the result is:
7.549 instances of io.jmix.flowui.model.impl.CollectionContainerImpl, loaded by org.springframework.boot.loader.launch.LaunchedClassLoader @ 0x740002298 occupy 2.445.524.608 (76,22 %) bytes.
Hi,
So finally exist two wins:
io.jmix.flowui.data.binding.impl.HtmlContainerReadonlyDataBindingImpl
and
io.jmix.flowui.model.impl.CollectionContainerImpl
after little more 400 records inserted with jmix application I have OutOfMemory (at 18,7% from memory I have 16G in this machine), this time I installed on tomcat:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
tomcat 4708 10.9 18.5 8838264 3029492 ? SNl 08:41 9:17 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -Djava.util.logging.config.file=/opt/tomcat/latest/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xms512M -Xmx2048M -server -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heapdump.bin -Dspring.profiles.active=prod -classpath /opt/tomcat/latest/bin/bootstrap.jar:/opt/tomcat/latest/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat/latest -Dcatalina.home=/opt/tomcat/latest -Djava.io.tmpdir=/opt/tomcat/latest/temp org.apache.catalina.startup.Bootstrap start
Hi,
I not start a new post, but when I deploy as WAR I seen the user directory used for .jmix/(temp,work) is / (root). I have in code another directory named qrCodeImage what is created in the user directory and these was created correctly in /opt/tomcat, so I fixed with next setting in application,properties file:
# When deploy as WAR uncomment next settings because use directory / as user tomcat directory
# For storage directory
jmix.localfs.storage-dir = /opt/tomcat/.genedatabank_storage/work/filestorage
# For temporary directory
mix.core.temp-dir = /opt/tomcat/.genedatabank_storage/temp
and these off course work.
My response for cat /etc/passwd
files:
tomcat:x:1001:1001::/opt/tomcat:/bin/false
user tomcat
was created with:
useradd -m -U -d /opt/tomcat -s /bin/false tomcat
For who need I written, at Tomcat | Florin Tanasă , in the past a tutorial how can installed tomcat server, is in Romanian but with Google translate work .
LE> Error message was io.jmix.core.FileStorageException: I/O error: Cannot create filestorage directory: /.jmix/work/filestorage
Finally after some days of investigation I found some problems:
How I say I have an button with Copy and Edit function, example take it from here https://demo.jmix.io/ui-samples/sample/copy-action my code was this:
public class PasaportListView extends StandardListView<Pasaport> {
@ViewComponent
private DataGrid<Pasaport> pasaportsDataGrid;
@Autowired
private MetadataTools metadataTools;
@Autowired
private DialogWindows dialogWindows;
@Subscribe("pasaportsDataGrid.copyEdit")
public void onPasaportsDataGridCopyEdit(final ActionPerformedEvent event) {
Pasaport pasaport = pasaportsDataGrid.getSingleSelectedItem();
Pasaport pasaportCopy = createCopy(pasaport);
dialogWindows.detail(pasaportsDataGrid)
.withViewClass(PasaportDetailView.class)
.newEntity(pasaportCopy)
.open();
}
public Pasaport createCopy(Pasaport pasaport) {
Pasaport pasaportCopy = metadataTools.copy(pasaport);
pasaportCopy.setId(UuidProvider.createUuid());
pasaportCopy.setAccenumb(null);
pasaportCopy.setAccname(StringUtils.abbreviate("Copie a " + pasaport.getAccname(),45));
return pasaportCopy;
}
}
Before jmix 2.4.0 this give me OutOfMemory at this class, after 400 push Copy and Edit:
My users use in this moment this function and Modify function and little Create new records, until jmix 240 works because time to time an user use Create new record and this moment Heap Memory clean
How you can see in nex picture after every 200 Copy and edit I press Create new record and in this moment Heap Memory Usage down (clean) not was important to save or not something.
After jmix 240 appear another problem with because not clean if I use Create new record and have new class ‘HtmlContainerReadonlyDataBindingImpl’ in OutOfMemory:
Now I try to rewritten function copy and edit like this:
public class PasaportListView extends StandardListView<Pasaport> {
@Autowired
protected DataManager dataManager;
@ViewComponent
private DataGrid<Pasaport> pasaportsDataGrid;
@Autowired
private DialogWindows dialogWindows;
@Subscribe("pasaportsDataGrid.copyEdit")
public void onPasaportsDataGridCopyEdit(final ActionPerformedEvent event) {
Pasaport pasaport = pasaportsDataGrid.getSingleSelectedItem();
if (pasaport != null) {
Pasaport pasaportCopy = createCopy(pasaport);
dialogWindows.detail(pasaportsDataGrid)
.withViewClass(PasaportDetailView.class)
.newEntity(pasaportCopy)
.open();
}
}
public Pasaport createCopy(Pasaport pasaport) {
/*
Pasaport pasaportCopy = metadataTools.copy(pasaport);
Pasaport pasaportCopy = dataManager.load(Pasaport.class).id(pasaport.getId()).one();
pasaportCopy.setId(UuidProvider.createUuid());
pasaportCopy.setAccenumb(null);
pasaportCopy.setAccname(StringUtils.abbreviate("Copie a " + pasaport.getAccname(),45));
return pasaportCopy;
*/
Pasaport pasaportNew = dataManager.create(Pasaport.class);
pasaportNew.setAccname(StringUtils.abbreviate("Copie a " + pasaport.getAccname(),45));
pasaportNew.setAcceurl(pasaport.getAcceurl());
pasaportNew.setAcqdate(pasaport.getAcqdate());
pasaportNew.setAncest(pasaport.getAncest());
pasaportNew.setColldate(pasaport.getColldate());
pasaportNew.setCollmissid(pasaport.getCollmissid());
pasaportNew.setCollnumb(pasaport.getCollnumb());
pasaportNew.setComments(pasaport.getComments());
pasaportNew.setDoi(pasaport.getDoi());
pasaportNew.setDonornumb(pasaport.getDonornumb());
pasaportNew.setElevation(pasaport.getElevation());
pasaportNew.setId_acceconf(pasaport.getId_acceconf());
pasaportNew.setId_aegisstat(pasaport.getId_aegisstat());
pasaportNew.setId_bredcode(pasaport.getId_bredcode());
pasaportNew.setId_collsrc(pasaport.getId_collsrc());
pasaportNew.setId_country(pasaport.getId_country());
pasaportNew.setId_collcode(pasaport.getId_collcode());
pasaportNew.setId_countysiruta(pasaport.getId_countysiruta());
pasaportNew.setId_donorcode(pasaport.getId_donorcode());
pasaportNew.setId_duplsite(pasaport.getId_duplsite());
pasaportNew.setId_georefmeth(pasaport.getId_georefmeth());
pasaportNew.setId_historic(pasaport.getId_historic());
pasaportNew.setId_instcode(pasaport.getId_instcode());
pasaportNew.setId_localitysiruta(pasaport.getId_localitysiruta());
pasaportNew.setId_mlsstat(pasaport.getId_mlsstat());
pasaportNew.setId_sampstat(pasaport.getId_sampstat());
pasaportNew.setId_taxonomy(pasaport.getId_taxonomy());
pasaportNew.setLatitude(pasaport.getLatitude());
pasaportNew.setLongitude(pasaport.getLongitude());
pasaportNew.setOrigdate(pasaport.getOrigdate());
pasaportNew.setOthernumb(pasaport.getOthernumb());
//pasaportNew.setProbeImages(pasaport.getProbeImages());
pasaportNew.setRemarks(pasaport.getRemarks());
pasaportNew.setTempnumb(pasaport.getTempnumb());
return pasaportNew;
}
}
and I added in ‘PasaportDetailView.class’ idea from @d.kremnev , may be I do it correctly
@Autowired
private HtmlContainerReadonlyDataBindingImpl flowui_HtmlContainerDataBinding;
@Subscribe
public void onDetachEvent(final DetachEvent event) {
flowui_HtmlContainerDataBinding.unbind(imageProbe);
//notifications.create("Unbind").show();
}
and now the comportment is the same before jmix 240:
From 13:30 to 13:50 I push Copy and edit function, for 200 times, after that I push Create new record, also from 13:50 to 14:10, after that take a break because was necessary to change fan from refrigerator machine, after 15:00 I start to push only Create new record for another 200 times. How you can see is difference, for Heap Memory Usage, from how is open and close an form for this two method.
May be I helped in some way the development team for this investigation (Heap Memory problem).