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

[core] _ActorClassMetadata.last_export_session_and_job should not be pickled #44380

Closed
rynewang opened this issue Mar 31, 2024 · 1 comment · Fixed by #44381
Closed

[core] _ActorClassMetadata.last_export_session_and_job should not be pickled #44380

rynewang opened this issue Mar 31, 2024 · 1 comment · Fixed by #44381
Assignees
Labels
bug Something that is supposed to be working; but isn't core Issues that should be addressed in Ray Core P1 Issue that should be fixed within a few weeks stability

Comments

@rynewang
Copy link
Contributor

What happened + What you expected to happen

In actor.py, _ActorClassMetadata is a simple data class and is automatically pickled/unpickled. This means the field last_export_session_and_job is passed across workers. However it should not - the session index is a worker-local concept and does not mean anything when passed around.

This has a real issue because, it's used to determine if we need to upload actor class to GCS. If in a first session we upload it and thus setting session = 0; then in second session, we pass the Actor to a task (fresh worker, session = 0) and invoke the Actor, the worker thinks it's already uploaded and skip the upload, causing actor creation failure.

Versions / Dependencies

master

Reproduction script

import ray

@ray.remote
class A:
    def __init__(self):
        print("A.__init__")
    def hello(self):
        print("A.hello")

ray.init()
# Here: A session = None, worker session = 0; uploaded.
a = A.remote()
# Here: A session = 0
ray.get(a.hello.remote())
ray.shutdown()

@ray.remote
def f():
    # A is unpickled with session = 0 (should be = None)
    # Here: A session = 0, worker.session = 0, does not upload A.
    # actor creation failed.
    a = A.remote()
    ray.get(a.hello.remote())

ray.get(f.remote())

Issue Severity

Medium: It is a significant difficulty but I can work around it.

@rynewang rynewang added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) P1 Issue that should be fixed within a few weeks core Issues that should be addressed in Ray Core labels Mar 31, 2024
@jjyao jjyao removed the triage Needs triage (eg: priority, bug/not-bug, and owning component) label Apr 1, 2024
@jjyao jjyao added the stability label Apr 1, 2024
@rynewang
Copy link
Contributor Author

rynewang commented Apr 5, 2024

Same things happen for Ray Tasks - class RemoteFunction is having a similar field _last_export_session_and_job and if we replicate the repro script for task, it hangs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't core Issues that should be addressed in Ray Core P1 Issue that should be fixed within a few weeks stability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants