jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java
author weijun
Thu, 02 Jul 2015 13:20:46 +0800
changeset 31473 650c75fa6728
parent 31472 850f01aa6a87
child 40449 5fbe26f13a4e
permissions -rw-r--r--
8130297: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java still failing after JDK-8076040 Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     1
/*
21603
e88919c55dac 8027624: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java unstable again
dxu
parents: 13251
diff changeset
     2
 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     4
 *
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     8
 *
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    13
 * accompanied this code).
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    14
 *
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4821
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4821
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4821
diff changeset
    21
 * questions.
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    22
 */
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    23
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    24
/*
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    25
 * @test
21603
e88919c55dac 8027624: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java unstable again
dxu
parents: 13251
diff changeset
    26
 * @bug 6578538 8027624
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    27
 * @summary com.sun.crypto.provider.SunJCE instance leak using KRB5 and
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    28
 *     LoginContext
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    29
 * @author Brad Wetmore
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    30
 *
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    31
 * @run main/othervm -Xmx20m TestProviderLeak
4821
c4b695155c91 6923976: TestProviderLeak.java is using too small of an initial heap under newer Hotspot (b79+)
wetmore
parents: 715
diff changeset
    32
 *
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    33
 */
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    34
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    35
/*
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    36
 * We force the leak to become a problem by eating up most JVM free memory.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    37
 * In current runs on a server and client machine, it took roughly 50-150
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    38
 * iterations to have the memory leak or time-out shut down other operations.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    39
 * It complained about "JCE cannot authenticate the provider SunJCE" or timed
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    40
 * out.
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    41
 */
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    42
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    43
import javax.crypto.*;
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    44
import javax.crypto.spec.*;
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    45
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    46
import java.util.*;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    47
import java.util.concurrent.*;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    48
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    49
public class TestProviderLeak {
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    50
    private static final int MB = 1024 * 1024;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    51
    // Currently, 3MB heap size is reserved for running testing iterations.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    52
    // It is tweaked to make sure the test quickly triggers the memory leak
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    53
    // or throws out TimeoutException.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    54
    private static final int RESERVATION = 3;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    55
    // The maximum time, 5 seconds, to wait for each iteration.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    56
    private static final int TIME_OUT = 5;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    57
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    58
    private static Deque<byte []> eatupMemory() throws Exception {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    59
        dumpMemoryStats("Before memory allocation");
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    60
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    61
        Deque<byte []> data = new ArrayDeque<byte []>();
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    62
        boolean hasException = false;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    63
        while (!hasException) {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    64
            byte [] megaByte;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    65
            try {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    66
                megaByte = new byte [MB];
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    67
                data.add(megaByte);
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    68
            } catch (OutOfMemoryError e) {
31472
850f01aa6a87 8076040: Test com/sun/crypto/provider/KeyFactory/TestProviderLeak.java fails with -XX:+UseG1GC
weijun
parents: 21603
diff changeset
    69
                megaByte = null;    // Free memory ASAP
31473
650c75fa6728 8130297: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java still failing after JDK-8076040
weijun
parents: 31472
diff changeset
    70
650c75fa6728 8130297: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java still failing after JDK-8076040
weijun
parents: 31472
diff changeset
    71
                int size = data.size();
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    72
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    73
                for (int j = 0; j < RESERVATION && !data.isEmpty(); j++) {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    74
                    data.removeLast();
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    75
                }
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    76
                System.gc();
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    77
                hasException = true;
31473
650c75fa6728 8130297: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java still failing after JDK-8076040
weijun
parents: 31472
diff changeset
    78
                System.out.println("OOME is thrown when allocating "
650c75fa6728 8130297: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java still failing after JDK-8076040
weijun
parents: 31472
diff changeset
    79
                        + size + "MB memory.");
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    80
            }
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    81
        }
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    82
        dumpMemoryStats("After memory allocation");
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    83
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    84
        return data;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    85
    }
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    86
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    87
    private static void dumpMemoryStats(String s) throws Exception {
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    88
        Runtime rt = Runtime.getRuntime();
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    89
        System.out.println(s + ":\t"
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    90
            + rt.freeMemory() + " bytes free");
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    91
    }
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    92
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    93
    public static void main(String [] args) throws Exception {
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    94
        // Prepare the test
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    95
        final SecretKeyFactory skf =
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    96
            SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1", "SunJCE");
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    97
        final PBEKeySpec pbeKS = new PBEKeySpec(
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
    98
            "passPhrase".toCharArray(), new byte [] { 0 }, 5, 512);
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
    99
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   100
        ExecutorService executor = Executors.newSingleThreadExecutor();
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   101
        Callable<SecretKey> task = new Callable<SecretKey>() {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   102
            @Override
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   103
            public SecretKey call() throws Exception {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   104
                return skf.generateSecret(pbeKS);
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   105
            }
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   106
        };
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   107
21603
e88919c55dac 8027624: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java unstable again
dxu
parents: 13251
diff changeset
   108
        // Eat up memory
e88919c55dac 8027624: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java unstable again
dxu
parents: 13251
diff changeset
   109
        Deque<byte []> dummyData = eatupMemory();
e88919c55dac 8027624: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java unstable again
dxu
parents: 13251
diff changeset
   110
        assert (dummyData != null);
e88919c55dac 8027624: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java unstable again
dxu
parents: 13251
diff changeset
   111
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   112
        // Start testing iteration
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   113
        try {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   114
            for (int i = 0; i <= 1000; i++) {
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   115
                if ((i % 20) == 0) {
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   116
                    // Calling gc() isn't dependable, but doesn't hurt.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   117
                    // Gives better output in leak cases.
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   118
                    System.gc();
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   119
                    dumpMemoryStats("Iteration " + i);
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   120
                }
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   121
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   122
                Future<SecretKey> future = executor.submit(task);
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   123
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   124
                try {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   125
                    future.get(TIME_OUT, TimeUnit.SECONDS);
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   126
                } catch (Exception e) {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   127
                    dumpMemoryStats("\nException seen at iteration " + i);
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   128
                    throw e;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   129
                }
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   130
            }
13251
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   131
        } finally {
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   132
            // JTReg will time out after two minutes. Proactively release
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   133
            // the memory to avoid JTReg time-out situation.
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   134
            dummyData = null;
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   135
            System.gc();
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   136
            dumpMemoryStats("Memory dereference");
58f0a0823496 7177045: Rework the TestProviderLeak.java regression test, it is too fragile to low memory errors.
khazra
parents: 7668
diff changeset
   137
            executor.shutdownNow();
101
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   138
        }
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   139
    }
3c3ec5dac510 6578538: com.sun.crypto.provider.SunJCE instance leak using KRB5 and LoginContext
wetmore
parents:
diff changeset
   140
}