[
https://issues.jboss.org/browse/WFLY-7037?page=com.atlassian.jira.plugin....
]
Manuel Blechschmidt commented on WFLY-7037:
-------------------------------------------
Hi guys,
I used a quite dirty workaround to resolve this. Maybe this is interesting for others as
well:
{code}
package de.blechschmidt.memory;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PreDestroy;
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Singleton
@Startup
public class MemoryLeakFixer {
private static final Logger log = Logger
.getLogger(MemoryLeakFixer.class.getName());
@PreDestroy
public void clean() {
try {
log.info("Fixing Memory Leak from: WFLY-7037");
Class<?> classUtil = Class
.forName("com.fasterxml.jackson.databind.util.ClassUtil");
//
https://stackoverflow.com/questions/3301635/change-private-static-final-f...
Field sCachedField = classUtil.getDeclaredField("sCached");
sCachedField.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(sCachedField,
sCachedField.getModifiers() & ~Modifier.FINAL);
Class<?> lruMapClass = Class
.forName("com.fasterxml.jackson.databind.util.LRUMap");
// Get a fresh new lruMap cache
Object lruMap = lruMapClass
.getConstructor(int.class, int.class)
.newInstance(48, 48);
// Reset the cache
sCachedField.set(null, lruMap);
} catch (ClassNotFoundException | NoSuchFieldException
| SecurityException | IllegalArgumentException
| IllegalAccessException | InstantiationException
| InvocationTargetException | NoSuchMethodException e) {
log.log(Level.WARNING, "Could not clean Jackson", e);
}
}
}
{code}
Memory leak when doing deploy/undeploy app using REST and JPA
-------------------------------------------------------------
Key: WFLY-7037
URL:
https://issues.jboss.org/browse/WFLY-7037
Project: WildFly
Issue Type: Bug
Components: REST, XML Frameworks
Affects Versions: 10.1.0.Final
Reporter: Tomas Remes
Assignee: Stuart Douglas
Priority: Critical
Fix For: 11.0.0.Alpha1
Attachments: gc_path.png, mem-leak.zip
It seems that exposing some type (ApplicationUser in attached app) which has enum type as
attribute via REST api could cause memory leak (See steps to reproduce). You can observe
that person.joey.test.UserType instances are kept in memory when GC happens (metaspace
exceeds) and the path to GC root looks:
!gc_path.png|thumbnail!
Note that this map
https://github.com/FasterXML/jackson-databind/blob/jackson-databind-2.7.4...
was not available in 2.5.4 version used in WF 10.0.0.Final
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)