Hi all,
I'm running a web-app in Tomcat using jOOQ to access a PostgreSQL
database and some months ago I upgraded jOOQ to version 3.11.7, a bit
later OpenJDK to version 8 and Tomcat as well on my production
servers. At first, things seemed to work fine, but end of March this
year I encountered the OOM "Compressed class space" for the first
time, which happened two additional times since then, once every
month. But I'm somewhat sure that this is really only by accident and
simply depends on how often Tomcat got restarted.
Using JMX, I collected data for "GC.class_stats" the last few days and
recognized that the number of loaded classes is constantly growing,
reducing the meta space of the JVM at the same time. Diffing the files
showed especially some jOOQ-related classes increasing:
> org.jooq.conf.MappedSchema$JaxbAccessorF_input
> org.jooq.conf.MappedTable$JaxbAccessorF_input
> org.jooq.conf.RenderFormatting$JaxbAccessorF_indentation
> org.jooq.conf.RenderFormatting$JaxbAccessorF_printMargin
> org.jooq.conf.RenderMapping$JaxbAccessorF_schemata
[...]
> Searching for: org\.jooq\.conf\..+\$JaxbAccessorF_.+
> [...]\2019-05\29\18-53\JMC 04 Diag Cmds GC.class_stats.txt: 242
> [...]\2019-05\29\19-10\JMC 04 Diag Cmds GC.class_stats.txt: 530
> [...]\2019-05\30\19-15\JMC 04 Diag Cmds GC.class_stats.txt: 134842
> [...]\2019-05\31\19-10\JMC 04 Diag Cmds GC.class_stats.txt: 275290
> [...]\2019-06\02\12-45\JMC 04 Diag Cmds GC.class_stats.txt: 425626
Searching for "Compressed class space" before already, I came across
problems for the combination of Java 8 and JAXB:
https://stackoverflow.com/questions/40346869/how-to-analyze-memory-leaks-in-java-8-compressed-class-space?rq=1
https://stackoverflow.com/questions/3259291/do-i-have-a-jaxb-classloader-leak
https://stackoverflow.com/questions/33255578/old-jaxb-and-jdk8-metaspace-outofmemory-issue
So these jOOQ-classes got my attention and it seems that I'm suffering
from the same problem like mentioned on SO. The only problem is I
didn't find anyone else having the same problem with jOOQ and Java 8,
which makes me wonder.
So, in your opinion, does my investigation make sense so far? Did
anyone else ran into the same problem already and I just missed it? If
so, how did you resolve the problem?
I've read that jOOQ gets rid of JAXB in version 3.12 and am going to
give this a try next most likely:
> In hindsight, I deeply regret having ever used JAXB. jOOQ 3.12 will
> ship with its own "mini JAXB" implementation to get rid of this mess
> for most people, depending only on the API (annotations).
https://github.com/jOOQ/jOOQ/issues/6879#issuecomment-440213498
If my investigation is correct and others simply did not run into
this pretty often yet, jOOQ might want to consider backporting one of
the SO-fixes mentioned to older versions as well. Because fomr my
understanding of the problem, everyone should run into this in
persistent environment with long-running JVMs sooner or later.
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: Thorsten....@AM-SoFT.de
AM-SoFT IT-Systeme
http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow