Jan Supol | 12a0573 | 2018-04-25 17:50:03 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!-- |
| 3 | |
jersey-bot | 59a5d50 | 2024-01-07 02:21:04 +0000 | [diff] [blame] | 4 | Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved. |
Jan Supol | 12a0573 | 2018-04-25 17:50:03 +0200 | [diff] [blame] | 5 | |
| 6 | This program and the accompanying materials are made available under the |
| 7 | terms of the Eclipse Public License v. 2.0, which is available at |
| 8 | http://www.eclipse.org/legal/epl-2.0. |
| 9 | |
| 10 | This Source Code may also be made available under the following Secondary |
| 11 | Licenses when the conditions for such availability set forth in the |
| 12 | Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| 13 | version 2 with the GNU Classpath Exception, which is available at |
| 14 | https://www.gnu.org/software/classpath/license.html. |
| 15 | |
| 16 | SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| 17 | |
| 18 | --> |
| 19 | |
| 20 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
| 21 | |
| 22 | <modelVersion>4.0.0</modelVersion> |
| 23 | |
| 24 | <parent> |
| 25 | <groupId>org.glassfish.jersey.tests.memleaks.redeployment</groupId> |
| 26 | <artifactId>project</artifactId> |
jersey-bot | 9727e9a | 2024-01-07 02:21:50 +0000 | [diff] [blame] | 27 | <version>4.0.99-SNAPSHOT</version> |
Jan Supol | 12a0573 | 2018-04-25 17:50:03 +0200 | [diff] [blame] | 28 | </parent> |
| 29 | |
| 30 | <artifactId>redeployment-threadlocals-app</artifactId> |
| 31 | <packaging>war</packaging> |
| 32 | <name>jersey-tests-memleak-redeployment-threadlocals-app</name> |
| 33 | |
| 34 | <description> |
| 35 | |
| 36 | This project shows that not careful use of ThreadLocal in a thread-pool environment is a risk. In this case, memory leaks |
| 37 | may occur under certain circumstances. |
| 38 | |
| 39 | Known cases when memory leaks do happen: |
| 40 | |
| 41 | [1] Tomcat with deployment by using its admin REST API (copying to webapps dir does not cause a memory leak since the |
| 42 | initialization of the application is done by a different thread, which might get eventually discarded.) |
| 43 | |
| 44 | [2] Glassfish - probably works due to a fact, that HK2 is not used (as opposed to redeployment-no-jersey-test-app) and the |
| 45 | classes that participate on strong references to a GC root are loaded by webapp classloader. |
| 46 | |
| 47 | |
| 48 | To run this test threadlocals classloader memory leak example, execute from jersey root dir: |
| 49 | |
| 50 | [1] Glassfish: mvn clean install -pl :redeployment-threadlocals-app -P gf4,memleak-leaking-test,memleak-redeployment |
| 51 | |
| 52 | [2] Weblogic: mvn clean install -pl :redeployment-threadlocals-app -P wls,memleak-leaking-test,memleak-redeployment |
| 53 | |
| 54 | [3] Tomcat: mvn clean install -pl :redeployment-threadlocals-app -P tomcat,memleak-leaking-test,memleak-redeployment |
| 55 | |
| 56 | </description> |
| 57 | |
| 58 | <properties> |
| 59 | <memleak.jvm.maxheap>128m</memleak.jvm.maxheap> |
| 60 | <external.container.contextRoot>hello</external.container.contextRoot> |
| 61 | |
| 62 | <memleak.redeploy.count>10000</memleak.redeploy.count> |
| 63 | <memleak.redeploy.expectedStatus>200</memleak.redeploy.expectedStatus> |
| 64 | <memleak.redeploy.requestPathQuery>${external.container.contextRoot}</memleak.redeploy.requestPathQuery> |
| 65 | </properties> |
| 66 | |
| 67 | <profiles> |
| 68 | <profile> |
| 69 | <id>tomcat</id> |
| 70 | <properties> |
| 71 | <memleak.jvm.maxheap>48m</memleak.jvm.maxheap> |
| 72 | </properties> |
| 73 | </profile> |
| 74 | <profile> |
| 75 | <id>memleak-leaking-test</id> |
| 76 | <build> |
| 77 | <plugins> |
| 78 | <plugin> |
| 79 | <groupId>org.codehaus.mojo</groupId> |
| 80 | <artifactId>build-helper-maven-plugin</artifactId> |
| 81 | </plugin> |
| 82 | <plugin> |
| 83 | <groupId>org.mortbay.jetty</groupId> |
| 84 | <artifactId>jetty-maven-plugin</artifactId> |
| 85 | </plugin> |
| 86 | <plugin> |
| 87 | <groupId>org.glassfish.jersey.test-framework.maven</groupId> |
| 88 | <artifactId>container-runner-maven-plugin</artifactId> |
| 89 | </plugin> |
| 90 | <plugin> |
| 91 | <groupId>org.apache.maven.plugins</groupId> |
| 92 | <artifactId>maven-enforcer-plugin</artifactId> |
| 93 | <executions> |
| 94 | <execution> |
| 95 | <id>enforce-out-of-memory-did-not-occur</id> |
| 96 | <phase>${phase.redeployment.post-integration-test}</phase> |
| 97 | </execution> |
| 98 | </executions> |
| 99 | </plugin> |
| 100 | </plugins> |
| 101 | </build> |
| 102 | </profile> |
| 103 | </profiles> |
| 104 | |
| 105 | <dependencies> |
| 106 | <dependency> |
jansupol | 7aebbcf | 2018-12-04 14:32:47 +0100 | [diff] [blame] | 107 | <groupId>jakarta.servlet</groupId> |
| 108 | <artifactId>jakarta.servlet-api</artifactId> |
Jan Supol | 12a0573 | 2018-04-25 17:50:03 +0200 | [diff] [blame] | 109 | <scope>provided</scope> |
| 110 | </dependency> |
| 111 | </dependencies> |
| 112 | |
| 113 | |
| 114 | </project> |