ballerina-lang
ballerina-lang copied to clipboard
[Bug]: Strand is not yeilding at `runtime:sleep`
Description
Assume we have two worker, say w1 and w2 and have an alternate wait (ie. wait w1|w2). Now assume we have a runtime:sleep in the first worker to execute (say this is w1). When we hit this sleep it should cause the strand of w1 to pause. This should free us the thread that was running that strand to execute w2. However this doesn't happen and instead w1 blocks the execution of the program.
Steps to Reproduce
- Clone https://github.com/heshanpadmasiri/worker-yeild-bug
- Run
bal runin fallowing directories
worker w2 should run first and when it hits sleep it don't yield and handover to w1
I couldn't get a more simpler test case to work since runtime will always choose to execute worker without the sleep every time. This is the only time I managed to get the runtime to run the worker with sleep first
Affected Version(s)
verified on 2201.8.6
OS, DB, other environment details and versions
No response
Related area
-> Runtime
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response