Package org.opensearch.test.disruption
Class LongGCDisruption
java.lang.Object
org.opensearch.test.disruption.SingleNodeDisruption
org.opensearch.test.disruption.LongGCDisruption
- All Implemented Interfaces:
ServiceDisruptionScheme
- Direct Known Subclasses:
IntermittentLongGCDisruption
public class LongGCDisruption extends SingleNodeDisruption
Suspends all threads on the specified node in order to simulate a long gc.
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringdisruptedNodeFields inherited from class org.opensearch.test.disruption.SingleNodeDisruption
cluster, logger, random -
Constructor Summary
Constructors Constructor Description LongGCDisruption(java.util.Random random, java.lang.String disruptedNode) -
Method Summary
Modifier and Type Method Description org.opensearch.common.unit.TimeValueexpectedTimeToHeal()protected longgetBlockDetectionIntervalInMillis()protected longgetSuspendingTimeoutInMillis()protected java.util.regex.Pattern[]getUnsafeClasses()booleanisBlockDetectionSupported()booleanisDisruptedNodeThread(java.lang.String threadName)protected voidonBlockDetected(java.lang.management.ThreadInfo blockedThread, java.lang.management.ThreadInfo blockingThread)voidremoveAndEnsureHealthy(InternalTestCluster cluster)protected voidresumeThreads(java.util.Set<java.lang.Thread> threads)booleansawSlowSuspendBug()Checks if during disruption we ran into a known JVM issue that makesThread.suspend()calls block for multiple seconds was observed.voidstartDisrupting()voidstopDisrupting()protected booleansuspendThreads(java.util.Set<java.lang.Thread> nodeThreads)resolves all threads belonging to given node and suspends them if their current stack trace is "safe".Methods inherited from class org.opensearch.test.disruption.SingleNodeDisruption
applyToCluster, applyToNode, ensureNodeCount, removeFromCluster, removeFromNode, testClusterClosed
-
Field Details
-
disruptedNode
protected final java.lang.String disruptedNode
-
-
Constructor Details
-
LongGCDisruption
public LongGCDisruption(java.util.Random random, java.lang.String disruptedNode)
-
-
Method Details
-
sawSlowSuspendBug
public boolean sawSlowSuspendBug()Checks if during disruption we ran into a known JVM issue that makesThread.suspend()calls block for multiple seconds was observed.- Returns:
- true if during thread suspending a call to
Thread.suspend()took more than 3s - See Also:
- JDK-8218446
-
startDisrupting
public void startDisrupting() -
isDisruptedNodeThread
public boolean isDisruptedNodeThread(java.lang.String threadName) -
stopDisrupting
public void stopDisrupting() -
removeAndEnsureHealthy
-
expectedTimeToHeal
public org.opensearch.common.unit.TimeValue expectedTimeToHeal() -
suspendThreads
protected boolean suspendThreads(java.util.Set<java.lang.Thread> nodeThreads)resolves all threads belonging to given node and suspends them if their current stack trace is "safe". Threads are added to nodeThreads if suspended. returns true if some live threads were found. The caller is expected to call this method until no more "live" are found. -
getUnsafeClasses
protected java.util.regex.Pattern[] getUnsafeClasses() -
getSuspendingTimeoutInMillis
protected long getSuspendingTimeoutInMillis() -
isBlockDetectionSupported
public boolean isBlockDetectionSupported() -
getBlockDetectionIntervalInMillis
protected long getBlockDetectionIntervalInMillis() -
onBlockDetected
protected void onBlockDetected(java.lang.management.ThreadInfo blockedThread, @Nullable java.lang.management.ThreadInfo blockingThread) -
resumeThreads
protected void resumeThreads(java.util.Set<java.lang.Thread> threads)
-