Skip to content

[Asyncio] InvalidStateError when multiple awaits on same oid #8841

@simon-mo

Description

@simon-mo

What is the problem?

Ray version and other system information (Python version, TensorFlow version, OS):

Reproduction (REQUIRED)

Please provide a script that can be run to reproduce the issue. The script should have no external library dependencies (i.e., use fake or mock data / environments):

If we cannot run your script, we cannot fix your issue.

import ray
import time

ray.init()
@ray.remote
def f():
    time.sleep(5)

oid = f.remote()
await asyncio.wait_for(oid, timeout=1)
await asyncio.wait_for(oid, timeout=1)

Output

Exception in callback get_async.<locals>.done_callback(<Future finis... result=None)>) at /Users/simonmo/Desktop/ray/ray/python/ray/async_compat.py:65
handle: <Handle get_async.<locals>.done_callback(<Future finis... result=None)>) at /Users/simonmo/Desktop/ray/ray/python/ray/async_compat.py:65>
Traceback (most recent call last):
  File "/Users/simonmo/miniconda3/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/Users/simonmo/Desktop/ray/ray/python/ray/async_compat.py", line 83, in done_callback
    user_future.set_result(result.result)
asyncio.base_futures.InvalidStateError: invalid state
  • I have verified my script runs in a clean environment and reproduces the issue.
  • I have verified the issue also occurs with the latest wheels.

Metadata

Metadata

Assignees

Labels

P0Issues that should be fixed in short orderbugSomething that is supposed to be working; but isn'trelease-blockerP0 Issue that blocks the release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions