Skip to content
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

[Bug]: Strand is not yeilding at runtime:sleep #42678

Open
heshanpadmasiri opened this issue May 2, 2024 · 0 comments
Open

[Bug]: Strand is not yeilding at runtime:sleep #42678

heshanpadmasiri opened this issue May 2, 2024 · 0 comments
Labels
Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug

Comments

@heshanpadmasiri
Copy link
Member

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

  1. Clone https://github.com/heshanpadmasiri/worker-yeild-bug
  2. Run bal run in fallowing directories
    1. ExternalServices
    2. server
    3. client

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

@ballerina-bot ballerina-bot added the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
None yet
Development

No branches or pull requests

2 participants