question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Core] support out of order execution for threaded/async actors

See original GitHub issue

The following will timeout

import ray
ray.init()

@ray.remote
class A:
    def echo(self, inp):
        print(inp)
        return inp

@ray.remote
def never_return():
    import time
    time.sleep(10000)

inp_ref_1 = never_return.remote()
inp_ref_2 = ray.put(2)

a = A.options(max_concurrency=2).remote()

out_ref_1 = a.echo.remote(inp_ref_1)
out_ref_2 = a.echo.remote(inp_ref_2)

assert ray.get(out_ref_2, timeout=5) == 2 # currently timeout!

I went all the way back to Ray 0.8.0 and it is the same behavior, so this is not a regression. For concurrent actors and async actors, however, I think the snippet should work and we should allow later tasks to execute first when their dependencies ready. This is a semantics change.

Context: user bug report for Ray Serve https://discuss.ray.io/t/concurrent-queries-blocking-following-queries/3949/2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
ericlcommented, Oct 28, 2021

Sounds good. I looked at this a bit more and I think we can potentially just enable it by default for concurrent/async actors, since the ordering was never really guaranteed for these in the first place.

Unfortunately the implementation may be quite tricky upon a deeper look. We might have to both change the client side dependency resolution logic, as well as the server queueing logic.

2reactions
scv119commented, Oct 28, 2021

Maybe I can take this. it’s a forcing function for me to get a bit more familiar with this part of the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AsyncIO / Concurrency for Actors — Ray 2.2.0
Within a single actor process, it is possible to execute concurrent threads. Ray offers two types of concurrency within an actor: async execution....
Read more >
Swift concurrency: Behind the scenes - WWDC NOTES
Reentrancy and prioritization · actors can execute items in an order that is not strictly first-in, first-out · actor new work items can...
Read more >
Swift actors tutorial - a beginner's guide to thread safe ...
Learn how to use the brand new actor model to protect your application from unwanted data-races and memory issues.
Read more >
Swift actors: How do they work, and what kinds of problems do ...
One of the core advantages of Swift's new actor types is that they can ... in serial order, regardless of which thread or...
Read more >
Actors, the cooperative pool and concurrency - try Code
Running a single actor method · The cooperative thread pool that was mentioned in the WWDC videos is a concurrent dispatch queue called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found