-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixing ehcache flaky test * Adding a ehcache issue reference for thread leak issue * Updating comment --------- (cherry picked from commit f4a8d2b) Signed-off-by: Sagar Upadhyaya <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
22f36e3
commit 40c73e0
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
.../cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhcacheThreadLeakFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cache.store.disk; | ||
|
||
import com.carrotsearch.randomizedtesting.ThreadFilter; | ||
|
||
/** | ||
* In Ehcache(as of 3.10.8), while calling remove/invalidate() on entries causes to start a daemon thread in the | ||
* background to clean up the stale offheap memory associated with the disk cache. And this thread is not closed even | ||
* after we try to close the cache or cache manager. Considering that it requires a node restart to switch between | ||
* different cache plugins, this shouldn't be a problem for now. | ||
* | ||
* See: https://github.com/ehcache/ehcache3/issues/3204 | ||
*/ | ||
public class EhcacheThreadLeakFilter implements ThreadFilter { | ||
|
||
private static final String OFFENDING_THREAD_NAME = "MappedByteBufferSource"; | ||
|
||
@Override | ||
public boolean reject(Thread t) { | ||
return t.getName().startsWith(OFFENDING_THREAD_NAME); | ||
} | ||
} |