-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ballerina hackathon use cases 7.1 and 7.2 are hanging when running the tests #5083
Comments
Tested this behavior with a simple ballerina project which has a simple HTTP service and a sub-module which has some async workers. modules/submodule/submodule.balimport ballerina/task;
import ballerina/time;
import ballerina/lang.runtime;
import ballerina/io;
function init() returns error? {
startWorkers();
task:Job job = object {
public function execute() {
startWorkers();
}
};
_ = check task:scheduleOneTimeJob(job, time:utcToCivil(time:utcAddSeconds(time:utcNow(), 3)));
}
function startWorkers() {
foreach string wk in ["w1", "w2", "w3"] {
_ = start run(wk);
}
}
isolated function run(string workerName) {
while true {
io:println("Running bal-worker", workerName);
runtime:sleep(10);
}
}
In the project tests I have imported this module. tests/service_test.balimport ballerina/io;
import ballerina/http;
import ballerina/test;
import bal_test.submodule as _;
// ballerina tests here When I run the test for this project the tests are hanging. @warunalakshitha / @HindujaB cn you guys check this out ? Sample code can be found here [1] [1] - https://drive.google.com/file/d/1GY_vXG117vpm4HeL40TLyr94YEDZ515y/view?usp=sharing |
This seems like a bug from runtime test execution. |
This code seems to be working with So the issue could be from somewhere else. |
The following code hangs at runtime. import ballerina/task;
import ballerina/time;
import ballerina/lang.runtime;
string[] & readonly arr = ["a", "b", "c"];
public function func() {
foreach var val in arr {
_ = @strand {thread: "any"} start foo(val);
}
}
function foo(string s) returns error? {
while true {
}
}
function init() returns error? {
task:Job job = object {
public function execute() {
func();
}
};
_ = check task:scheduleOneTimeJob(job, time:utcToCivil(time:utcAddSeconds(time:utcNow(), 3)));
}
public function main() {
runtime:sleep(3);
} It has been observed from the Ballerina version Following is the strand-dump of above program
All strand groups are in runnable state. |
Description:
Distribution Version
Related to #3464
The text was updated successfully, but these errors were encountered: