From 1f4f7fe0d070817eccc90e1736e37cf56ab02a5c Mon Sep 17 00:00:00 2001 From: ravinperera00 Date: Mon, 9 Sep 2024 10:19:36 +0530 Subject: [PATCH] Implement strand dump tool for virtual threads --- .../internal/troubleshoot/StrandDump.java | 119 +++++++++--- .../src/main/java/module-info.java | 1 + .../balProgram1StrandDumpRegEx.txt | 75 ++++--- .../testOutputs/balTestStrandDumpRegEx.txt | 117 ++++++----- .../testPackageWithModulesStrandDumpRegEx.txt | 183 ++++++++++-------- 5 files changed, 298 insertions(+), 197 deletions(-) diff --git a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/troubleshoot/StrandDump.java b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/troubleshoot/StrandDump.java index 854123005bd3..144f30f74a05 100644 --- a/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/troubleshoot/StrandDump.java +++ b/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/troubleshoot/StrandDump.java @@ -18,13 +18,19 @@ package io.ballerina.runtime.internal.troubleshoot; -import io.ballerina.runtime.internal.scheduling.Strand; +import com.sun.management.HotSpotDiagnosticMXBean; +import javax.management.MBeanServer; +import java.io.File; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; /** * Used to get the status of current Ballerina strands. @@ -32,45 +38,94 @@ * @since 2201.2.0 */ public class StrandDump { + private static final String hotSpotBeanName = "com.sun.management:type=HotSpotDiagnostic"; + private static volatile HotSpotDiagnosticMXBean hotSpotDiagnosticMXBean; public static String getStrandDump() { - Map availableStrands = new HashMap<>(); - int createdStrandGroupCount = 0; - int createdStrandCount = 0; - int availableStrandCount = 0; - Map> availableStrandGroups = new HashMap<>(); - - String strandDumpOutput = generateOutput(availableStrandGroups, availableStrandCount, createdStrandGroupCount, - createdStrandCount); - cleanUp(availableStrands, availableStrandGroups); - return strandDumpOutput; + String filename = "thread_dump" + LocalDateTime.now(); + String dump; + try { + getStrandDump(System.getProperty("user.dir") + "/" + filename); + dump = new String(Files.readAllBytes(Paths.get(filename))); + File fileObj = new File(filename); + fileObj.delete(); + } catch (Exception e) { + return "Error occurred during strand dump generation"; + } + return generateOutput(dump); } - private static String generateOutput(Map> availableStrandGroups, int availableStrandCount, - int createdStrandGroupCount, int createdStrandCount) { + private static String generateOutput(String dump) { + String[] dump_items = dump.split("\\n\\n"); + int id = 0; + Set isolatedWorkerList = new HashSet<>(); + Set nonIsolatedWorkerList = new HashSet<>(); + ArrayList> balTraces = new ArrayList<>(); + for(String item : dump_items) { + String[] lines = item.split("\\n"); + String[] subitems = lines[0].split("\" "); + ArrayList balTraceItems = new ArrayList<>(); + boolean bal_strand = false; + if(subitems.length > 1 && subitems[1].equals("virtual")) { + balTraceItems.add("\tStrand " + lines[0].replace("virtual", ":") + "\n\t\tat"); + String prefix = " "; + for(String line : lines) { + if(line.contains("Scheduler.lambda$startIsolatedWorker")) { + isolatedWorkerList.add(id); + } + if(line.contains("Scheduler.lambda$startNonIsolatedWorker")) { + nonIsolatedWorkerList.add(id); + } + if(!line.contains("java") && !line.contains("\" virtual")){ + balTraceItems.add(prefix + line + "\n"); + prefix = "\t\t "; + } + if(line.contains(".bal")) { + bal_strand = true; + } + } + if(bal_strand) { + balTraces.add(balTraceItems); + }else { + isolatedWorkerList.remove(id); + nonIsolatedWorkerList.remove(id); + } + id++; + } + } StringBuilder outputStr = new StringBuilder("Ballerina Strand Dump ["); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); LocalDateTime localDateTime = LocalDateTime.now(); outputStr.append(dateTimeFormatter.format(localDateTime)); - outputStr.append("]\n===========================================\n\n"); - outputStr.append("Total strand group count \t:\t").append(createdStrandGroupCount).append("\n"); - outputStr.append("Total strand count \t:\t").append(createdStrandCount).append("\n"); - outputStr.append("Active strand group count\t:\t").append(availableStrandGroups.size()).append("\n"); - outputStr.append("Active strand count \t:\t").append(availableStrandCount).append("\n\n"); - availableStrandGroups.forEach((strandGroupId, strandList) -> { - outputStr.append("group ").append(strandGroupId).append(" [").append(strandList.get(0)).append("]: [") - .append(strandList.size() - 1).append("]\n"); - strandList.subList(1, strandList.size()).forEach(outputStr::append); - }); - outputStr.append("===========================================\n"); + outputStr.append("]\n===============================================================\n\n"); + outputStr.append("Total Strand count \t\t\t:\t").append(balTraces.size()).append("\n\n"); + outputStr.append("Total Isolated Worker count \t\t:\t").append(isolatedWorkerList.size()).append("\n\n"); + outputStr.append("Total Non Isolated Worker count \t\t:\t").append(nonIsolatedWorkerList.size()).append("\n\n"); + outputStr.append("================================================================\n"); + outputStr.append("\nIsolated Workers:\n\n"); + for(int strandId: isolatedWorkerList){ + balTraces.get(strandId).forEach(outputStr::append); + outputStr.append("\n"); + } + outputStr.append("Non Isolated Workers:\n\n"); + for(int strandId: nonIsolatedWorkerList){ + balTraces.get(strandId).forEach(outputStr::append); + outputStr.append("\n"); + } return outputStr.toString(); } - private static void cleanUp(Map availableStrands, - Map> availableStrandGroups) { - availableStrands.clear(); - availableStrandGroups.clear(); + private static void getStrandDump(String fileName) throws IOException { + if (hotSpotDiagnosticMXBean == null) { + synchronized (StrandDump.class) { + hotSpotDiagnosticMXBean = getHotSpotDiagnosticMXBean(); + } + } + hotSpotDiagnosticMXBean.dumpThreads(fileName, HotSpotDiagnosticMXBean.ThreadDumpFormat.TEXT_PLAIN); } - private StrandDump() {} + private static HotSpotDiagnosticMXBean getHotSpotDiagnosticMXBean() throws IOException { + MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); + return ManagementFactory.newPlatformMXBeanProxy(mBeanServer, hotSpotBeanName, HotSpotDiagnosticMXBean.class); + } } diff --git a/bvm/ballerina-runtime/src/main/java/module-info.java b/bvm/ballerina-runtime/src/main/java/module-info.java index 6fbcfaeef7c2..59271ae72dbc 100644 --- a/bvm/ballerina-runtime/src/main/java/module-info.java +++ b/bvm/ballerina-runtime/src/main/java/module-info.java @@ -17,6 +17,7 @@ requires java.naming; requires io.ballerina.identifier; requires jdk.unsupported; + requires jdk.management; // API exports exports io.ballerina.runtime.api; diff --git a/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balProgram1StrandDumpRegEx.txt b/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balProgram1StrandDumpRegEx.txt index 4a8567a9f2ec..5ada425e43a6 100644 --- a/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balProgram1StrandDumpRegEx.txt +++ b/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balProgram1StrandDumpRegEx.txt @@ -1,43 +1,56 @@ Ballerina Strand Dump \[\d*/\d*/\d* \d*:\d*:\d*\] -=========================================== +=============================================================== -Total strand group count \t:\t5 -Total strand count \t:\t9 -Active strand group count\t:\t3 -Active strand count \t:\t9 +Total Strand count \t\t\t:\t9 -group \d* \[QUEUED\]: \[7\] -\tstrand \d* "main" \[\$anon...0:main\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \t\$anon...0.0.0:bar\(balProgram1.bal:86\) -\t\t \t\$anon...0.0.0:foo\(balProgram1.bal:27\) -\t\t \t\$anon...0.0.0:main\(balProgram1.bal:23\) +Total Isolated Worker count \t\t:\t2 -\tstrand \d* "w3" \[\$anon...0:bar\]\[\d*\] \[BLOCKED ON WORKER MESSAGE SEND\]: -\t\tat\t\$anon...0.0.0:\$lambda\$_2\(balProgram1.bal:53\) +Total Non Isolated Worker count \t\t:\t7 -\tstrand \d* "w4" \[\$anon...0:bar\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \t\$anon...0.0.0:\$lambda\$_3\(balProgram1.bal:58\) +================================================================ -\tstrand \d* "w5" \[\$anon...0:bar\]\[\d*\] \[BLOCKED ON WORKER MESSAGE FLUSH\]: -\t\tat\t\$anon...0.0.0:\$lambda\$_4\(balProgram1.bal:65\) +Isolated Workers: -\tstrand \d* "w6" \[\$anon...0:bar\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \t\$anon...0.0.0:\$lambda\$_5\(balProgram1.bal:70\) +\tStrand #\d* \"\d*\" : +\t\tat balProgram1.\$lambda\$_0\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_0\$lambda0\$\(balProgram1.bal:\d*\) -\tstrand \d* \[\$anon...0:bar\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\t\$anon...0.0.0:\$lambda\$_6\(balProgram1.bal:76\) +\tStrand #\d* \"\d*\" : +\t\tat balProgram1.\$lambda\$_1\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_1\$lambda1\$\(balProgram1.bal:\d*\) -\tstrand \d* "w8" \[\$anon...0:bar\]\[\d*\] \[WAITING\]: -\t\tat\t\$anon...0.0.0:\$lambda\$_7\(balProgram1.bal:82\) +Non Isolated Workers: -group \d* \[RUNNABLE\]: \[1\] -\tstrand \d* "w1" \[\$anon...0:bar\]\[\d*\] \[RUNNABLE\] +\tStrand #\d* \"\d*\" : +\t\tat balProgram1.\$lambda\$_2\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_2\$lambda2\$\(balProgram1.bal:\d*\) -group \d* \[QUEUED\]: \[1\] -\tstrand \d* "w2" \[\$anon...0:bar\]\[\d*\] \[WAITING FOR LOCK\]: -\t\tat\t\$anon...0.0.0:\$lambda\$_1\(balProgram1.bal:46\) +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t balProgram1.\$lambda\$_3\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_3\$lambda3\$\(balProgram1.bal:\d*\) -=========================================== +\tStrand #\d* \"\d*\" : +\t\tat balProgram1.\$lambda\$_4\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_4\$lambda4\$\(balProgram1.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t balProgram1.\$lambda\$_5\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_5\$lambda5\$\(balProgram1.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t balProgram1.bar\(balProgram1.bal:\d*\) +\t\t balProgram1.foo\(balProgram1.bal:\d*\) +\t\t balProgram1.main\(balProgram1.bal:\d*\) +\t\t \$_init.\$moduleExecute\(.\) +\t\t \$_init.\$lambda\$\$moduleExecute\$\(.\) + +\tStrand #\d* \"\d*\" : +\t\tat balProgram1.\$lambda\$_6\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_6\$lambda6\$\(balProgram1.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat balProgram1.\$lambda\$_7\(balProgram1.bal:\d*\) +\t\t lambdas.\$_generated1balProgram1.\$lambda\$_7\$lambda7\$\(balProgram1.bal:\d*\) \ No newline at end of file diff --git a/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balTestStrandDumpRegEx.txt b/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balTestStrandDumpRegEx.txt index ccfab05b7d76..cf0d9cef88d9 100644 --- a/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balTestStrandDumpRegEx.txt +++ b/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/balTestStrandDumpRegEx.txt @@ -1,53 +1,66 @@ Ballerina Strand Dump \[\d*/\d*/\d* \d*:\d*:\d*\] -=========================================== - -Total strand group count \t:\t3 -Total strand count \t:\t8 -Active strand group count\t:\t1 -Active strand count \t:\t8 - -group \d* \[QUEUED\]: \[8\] -\tstrand \d* "main" \[testOrg.testPackageWithModules.0:main\] \[BLOCKED\]: -\t\tat\tballerina.lang.function.\d*.\d*.\d*:call\(function.bal:\d*\) -\t\t \tballerina.test.\d*.\d*.\d*:executeTestFunction\(serialExecuter.bal:\d*\) -\t\t \tballerina.test.\d*.\d*.\d*:executeNonDataDrivenTest\(serialExecuter.bal:\d*\) -\t\t \tballerina.test.\d*.\d*.\d*:executeTest\(serialExecuter.bal:\d*\) -\t\t \tballerina.test.\d*.\d*.\d*:executeTests\(execute.bal:\d*\) -\t\t \tballerina.test.\d*.\d*.\d*:startSuite\(execute.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:__execute__\(tests/test_execute-generated_1.bal:\d*\) -\t\t \t\$moduleExecute - -\tstrand \d* \[ballerina.lang.function.\d*.\d*.\d*:call\]\[\d*\] \[WAITING\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:bar\(main.bal:52\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:foo\(main.bal:37\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:foobar\(main.bal:33\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:testStrandDump\(tests/main_test.bal:35\) - -\tstrand \d* "w11" \[testOrg.testPackageWithModules.0:testStrandDump\]\[\d*\] \[WAITING\]: -\t\tat\ttestOrg.testPackageWithModules.anotherutils.0.1.0:func3\(anotherutils.bal:46\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:func2\(anotherutils.bal:29\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:func1\(anotherutils.bal:25\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:entryfunc\(anotherutils.bal:21\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_10\(tests/main_test.bal:26\) - -\tstrand \d* "w22" \[testOrg.testPackageWithModules.0:testStrandDump\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_11\(tests/main_test.bal:31\) - -\tstrand \d* "w1" \[testOrg.testPackageWithModules.0:bar\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:sleep_and_wait_nested\(main.bal:61\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:sleep_and_wait\(main.bal:56\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_0\(main.bal:42\) - -\tstrand \d* "w2" \[testOrg.testPackageWithModules.0:bar\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_1\(main.bal:48\) - -\tstrand \d* "w1" \[testOrg.testPackageWithModules.anotherutils.0:func3\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:sleep_and_wait_nested\(anotherutils.bal:55\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:sleep_and_wait\(anotherutils.bal:50\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:\$lambda\$_0\(anotherutils.bal:34\) - -\tstrand \d* "w2" \[testOrg.testPackageWithModules.anotherutils.0:func3\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\ttestOrg.testPackageWithModules.anotherutils.0.1.0:\$lambda\$_1\(anotherutils.bal:42\) \ No newline at end of file +=============================================================== + +Total Strand count \t\t\t:\t7 + +Total Isolated Worker count \t\t:\t0 + +Total Non Isolated Worker count \t\t:\t7 + +================================================================ + +Isolated Workers: + +Non Isolated Workers: + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.bar\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.foo\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.foobar\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.tests.main_test.testStrandDump\(tests/main_test.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.lambdas.\$_generated1tests.test_execute-generated_1.testStrandDump\$lambda0\$\(tests/test_execute-generated_1.bal:\d*\) +\t\t ballerina.lang&0046function.0.function.call\(function.bal:\d*\) +\t\t ballerina.test.0.serialExecuter.executeTestFunction\(serialExecuter.bal:\d*\) +\t\t ballerina.test.0.serialExecuter.executeNonDataDrivenTest\(serialExecuter.bal:\d*\) +\t\t ballerina.test.0.serialExecuter.executeTest\(serialExecuter.bal:\d*\) +\t\t ballerina.test.0.execute.executeTests\(execute.bal:\d*\) +\t\t ballerina.test.0.execute.startSuite\(execute.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.tests.test_execute-generated_1.__execute__\(tests/test_execute-generated_1.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.\$_init.\$moduleExecute\(testPackageWithModules\) +\t\t testOrg.testPackageWithModules\$test.0.\$_init.\$lambda\$\$moduleExecute\$\(testPackageWithModules\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.sleep_and_wait_nested\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.sleep_and_wait\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.\$lambda\$_0\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_0\$lambda3\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_1\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_1\$lambda4\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.sleep_and_wait_nested\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.sleep_and_wait\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.\$lambda\$_0\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.lambdas.\$_generated1anotherutils.\$lambda\$_0\$lambda0\$\(anotherutils.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.\$lambda\$_1\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.lambdas.\$_generated1anotherutils.\$lambda\$_1\$lambda1\$\(anotherutils.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.func3\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.func2\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.func1\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.entryfunc\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.tests.main_test.\$lambda\$_10\(tests/main_test.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.lambdas.\$_generated2tests.main_test.\$lambda\$_10\$lambda0\$\(tests/main_test.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.tests.main_test.\$lambda\$_11\(tests/main_test.bal:\d*\) +\t\t testOrg.testPackageWithModules\$test.0.lambdas.\$_generated2tests.main_test.\$lambda\$_11\$lambda1\$\(tests/main_test.bal:\d*\) + diff --git a/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/testPackageWithModulesStrandDumpRegEx.txt b/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/testPackageWithModulesStrandDumpRegEx.txt index 5629b1c1e76e..941e2180ed91 100644 --- a/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/testPackageWithModulesStrandDumpRegEx.txt +++ b/tests/jballerina-integration-test/src/test/resources/troubleshoot/strandDump/testOutputs/testPackageWithModulesStrandDumpRegEx.txt @@ -1,83 +1,102 @@ Ballerina Strand Dump \[\d*/\d*/\d* \d*:\d*:\d*\] -=========================================== - -Total strand group count \t:\t7 -Total strand count \t:\t18 -Active strand group count\t:\t5 -Active strand count \t:\t17 - -group \d* \[QUEUED\]: \[5\] -\tstrand \d* "main" \[testOrg.testPackageWithModules.0:main\] \[WAITING\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:bar\(main.bal:52\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:foo\(main.bal:37\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:foobar\(main.bal:33\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:main\(main.bal:29\) -\t\t \t\$moduleExecute - -\tstrand \d* "w1" \[testOrg.testPackageWithModules.utils.0:func3\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.utils.0.1.0:sleep_and_wait_nested\(utils.bal:53\) -\t\t \ttestOrg.testPackageWithModules.utils.0.1.0:sleep_and_wait\(utils.bal:48\) -\t\t \ttestOrg.testPackageWithModules.utils.0.1.0:\$lambda\$_0\(utils.bal:34\) - -\tstrand \d* "w2" \[testOrg.testPackageWithModules.utils.0:func3\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\ttestOrg.testPackageWithModules.utils.0.1.0:\$lambda\$_1\(utils.bal:42\) - -\tstrand \d* "w1" \[testOrg.testPackageWithModules.0:bar\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:sleep_and_wait_nested\(main.bal:61\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:sleep_and_wait\(main.bal:56\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_0\(main.bal:42\) - -\tstrand \d* "w2" \[testOrg.testPackageWithModules.0:bar\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_1\(main.bal:48\) - -group \d* \[QUEUED\]: \[7\] -\tstrand \d* "futureResult1" \[testOrg.testPackageWithModules.0:main\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:balfunc\(main.bal:120\) - -\tstrand \d* "w3" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[BLOCKED ON WORKER MESSAGE SEND\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_4\(main.bal:87\) - -\tstrand \d* "w4" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_5\(main.bal:92\) - -\tstrand \d* "w5" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[BLOCKED ON WORKER MESSAGE FLUSH\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_6\(main.bal:99\) - -\tstrand \d* "w6" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_7\(main.bal:104\) - -\tstrand \d* \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_8\(main.bal:110\) - -\tstrand \d* "w8" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[WAITING\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_9\(main.bal:116\) - -group \d* \[RUNNABLE\]: \[1\] -\tstrand \d* "w1" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[RUNNABLE\] - -group \d* \[QUEUED\]: \[1\] -\tstrand \d* "w2" \[testOrg.testPackageWithModules.0:balfunc\]\[\d*\] \[WAITING FOR LOCK\]: -\t\tat\ttestOrg.testPackageWithModules.0.1.0:\$lambda\$_3\(main.bal:80\) - -group \d* \[QUEUED\]: \[3\] -\tstrand \d* "futureResult3" \[testOrg.testPackageWithModules.0:main\]\[\d*\] \[WAITING\]: -\t\tat\ttestOrg.testPackageWithModules.anotherutils.0.1.0:func3\(anotherutils.bal:46\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:func2\(anotherutils.bal:29\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:func1\(anotherutils.bal:25\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:entryfunc\(anotherutils.bal:21\) - -\tstrand \d* "w1" \[testOrg.testPackageWithModules.anotherutils.0:func3\]\[\d*\] \[BLOCKED\]: -\t\tat\tballerina.lang.runtime.\d*.\d*.\d*:sleep\(runtime.bal:\d*\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:sleep_and_wait_nested\(anotherutils.bal:55\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:sleep_and_wait\(anotherutils.bal:50\) -\t\t \ttestOrg.testPackageWithModules.anotherutils.0.1.0:\$lambda\$_0\(anotherutils.bal:34\) - -\tstrand \d* "w2" \[testOrg.testPackageWithModules.anotherutils.0:func3\]\[\d*\] \[BLOCKED ON WORKER MESSAGE RECEIVE\]: -\t\tat\ttestOrg.testPackageWithModules.anotherutils.0.1.0:\$lambda\$_1\(anotherutils.bal:42\) - -=========================================== +=============================================================== + +Total Strand count \t\t\t:\t17 + +Total Isolated Worker count \t\t:\t4 + +Total Non Isolated Worker count \t\t:\t13 + +================================================================ + +Isolated Workers: + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.balfunc\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.balfunc\$lambda\$0\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_2\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_2\$lambda5\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_3\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_3\$lambda6\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.func3\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.func2\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.func1\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.entryfunc\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.creators.\$_function_calls.call\(Unknown Source\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.entryfunc\$lambda\$2\$\(main.bal:\d*\) + +Non Isolated Workers: + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_4\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_4\$lambda7\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.\$lambda\$_5\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_5\$lambda8\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_6\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_6\$lambda9\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.\$lambda\$_7\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_7\$lambda10\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_8\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_8\$lambda11\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_9\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_9\$lambda12\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046utils.0.utils.sleep_and_wait_nested\(utils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046utils.0.utils.sleep_and_wait\(utils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046utils.0.utils.\$lambda\$_0\(utils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046utils.0.lambdas.\$_generated1utils.\$lambda\$_0\$lambda0\$\(utils.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules&0046utils.0.utils.\$lambda\$_1\(utils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046utils.0.lambdas.\$_generated1utils.\$lambda\$_1\$lambda1\$\(utils.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.sleep_and_wait_nested\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.sleep_and_wait\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.\$lambda\$_0\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_0\$lambda3\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.\$lambda\$_1\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.lambdas.\$_generated1main.\$lambda\$_1\$lambda4\$\(main.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat ballerina.lang&0046runtime.0.runtime.sleep\(runtime.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.sleep_and_wait_nested\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.sleep_and_wait\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.\$lambda\$_0\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.lambdas.\$_generated1anotherutils.\$lambda\$_0\$lambda0\$\(anotherutils.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules&0046anotherutils.0.anotherutils.\$lambda\$_1\(anotherutils.bal:\d*\) +\t\t testOrg.testPackageWithModules&0046anotherutils.0.lambdas.\$_generated1anotherutils.\$lambda\$_1\$lambda1\$\(anotherutils.bal:\d*\) + +\tStrand #\d* \"\d*\" : +\t\tat testOrg.testPackageWithModules.0.main.bar\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.foo\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.foobar\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.main.main\(main.bal:\d*\) +\t\t testOrg.testPackageWithModules.0.\$_init.\$moduleExecute\(testPackageWithModules\) +\t\t testOrg.testPackageWithModules.0.\$_init.\$lambda\$\$moduleExecute\$\(testPackageWithModules\) \ No newline at end of file