简体   繁体   中英

integration test with cargo-maven2-plugin have memory leak during the stop

Hy everyone, I use the plugin cargo-maven2-plugin to run my integration test on tomcat 8 (waiting the tomcat8-maven-plugin)

Unfortunetly, I've this stack when I stop the container:

The web application [sportInfo] appears to have started a thread named [transcoder-2-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

And

java.lang.ref.WeakReference@606a2c5b}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

The full Stack:

[INFO] [talledLocalContainer] AVERTISSEMENT: The web application [sportInfo] appears to have started a thread named [transcoder-2-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: [INFO] [talledLocalContainer] sun.misc.Unsafe.park(Native Method) [INFO] [talledLocalContainer] java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) [INFO] [talledLocalContainer] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) [INFO] [talledLocalContainer] java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403) [INFO] [talledLocalContainer] java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) [INFO] [talledLocalContainer] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) [INFO] [talledLocalContainer] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [INFO] [talledLocalContainer] java.lang.Thread.run(Thread.java:745) [INFO] [talledLocalContainer] déc. 01, 2015 6:46:42 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks [INFO] [talledLocalContainer] GRAVE: The web application [sportInfo] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@38ba4aa4]) and a value of type [java.util.Hashtable] (value [{threadId=52, sessionId=6090c68d-a0f2-4df1-954c-10e907c93535, clientApi=-1, hostName=macbook-pro-de-sarah.local, request=DELETE:/sportInfo/private/cache/sportInfo/regions}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. [INFO] [talledLocalContainer] déc. 01, 2015 6:46:42 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks [INFO] [talledLocalContainer] GRAVE: The web application [sportInfo] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassFactory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@6778ecb0]) and a value of type [java.util.WeakHashMap] (value [{class fr.pmu.siteserver.domain.Type=java.lang.ref.WeakReference@6b3e31a2, class fr.pmu.commons.services.mapping.IntegerListAdapter=java.lang.ref.WeakReference@30fb58d2, class fr.pmu.siteserver.domain.Region=java.lang.ref.WeakReference@5afecb03, class fr.pmu.siteserver.domain.Class=java.lang.ref.WeakReference@7ac3b180, class fr.pmu.siteserver.domain.SSResponse=java.lang.ref.WeakReference@606a2c5b}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

my plugin config:

   <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.4.9</version>
                    <executions>
                        <execution>
                            <id>start-container</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>start</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>run</id>
                            <configuration>
                                <configuration>
                                    <properties>
                                    </properties>
                                </configuration>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                                <goal>start</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>stop-container</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                            <configuration>
                                <timeout>20000</timeout>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <container>
                            <containerId>tomcat8x</containerId>
                            <zipUrlInstaller>
                                <url>${tomcat8.url}</url>
                            </zipUrlInstaller>
                            <systemProperties>
                                <tomcat.instance.name>sportInfoIT</tomcat.instance.name>
                                <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
                            </systemProperties>
                        </container>
                        <configuration>
                            <type>standalone</type>
                            <home>${environment.catalina.home}</home>
                            <properties>
                                <cargo.servlet.port>9084</cargo.servlet.port>
                                <path>/${project.build.finalName}</path>
                            </properties>
                            <files>
                                <file>
                                    <file>${project.build.testOutputDirectory}</file>
                                    <todir>lib</todir>
                                </file>
                            </files>
                        </configuration>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <location>${project.build.directory}/${project.artifactId}-${project.version}.war
                                </location>
                                <properties>
                                    <context>${project.build.finalName}</context>
                                </properties>
                            </deployable>
                        </deployables>
                        <deployer>
                            <type>installed</type>
                        </deployer>
                    </configuration>
                </plugin>

Can you help me please?

Why you execute start goal twice? It is in pre integraton phase and then durign exceution. Maybe this is your problem? I mean that you are running it twice in two threads. And why is run execution configuration empty?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM