与 cargo-maven2-plugin 的集成测试在停止期间有内存泄漏

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

大家好, 我使用插件 cargo-maven2-plugin 运行 我在 tomcat 8 上的集成测试(等待 tomcat8-maven-plugin)

不幸的是,当我停止容器时我有这个堆栈:

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:

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.

完整堆栈:

[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] (value [com.sun.xml.bind.v2.ClassFactory@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.

我的插件配置:

   <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>

你能帮帮我吗?

为什么要执行两次开始目标?它处于预集成阶段,然后处于执行过程中。也许这是你的问题?我的意思是您在两个线程中 运行 将它连接了两次。 为什么运行执行配置为空?