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] AttributeError: module 'abc' has no attribute '_get_dump' #13209

Closed
1 of 2 tasks
PidgeyBE opened this issue Jan 5, 2021 · 7 comments · Fixed by #13242
Closed
1 of 2 tasks

[core] AttributeError: module 'abc' has no attribute '_get_dump' #13209

PidgeyBE opened this issue Jan 5, 2021 · 7 comments · Fixed by #13242
Assignees
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@PidgeyBE
Copy link
Contributor

PidgeyBE commented Jan 5, 2021

ray 1.1.0

What is the problem?

In ray 1.1.0 the following critical lines where removed from the codebase in 871cde9:

            if hasattr(abc, '_get_dump'):
                (registry, _, _, _) = abc._get_dump(obj)
                clsdict["_abc_impl"] = [subclass_weakref()
                                        for subclass_weakref in registry]
            else:
                # FIXME(suquark): The upstream cloudpickle cannot work in Ray
                # because sometimes both '_abc_registry' and '_get_dump' does
                # not exist. Some strange typing objects may cause this issue.
                # Here the workaround just set "_abc_impl" to None.
                clsdict["_abc_impl"] = None

As a result, our software CICD fails after upgrading to ray 1.1.0 with:
AttributeError: module 'abc' has no attribute '_get_dump'
If I just open ipython and import abc, I get the same error on abc._get_dump. We are using python 3.6.

Reproduction (REQUIRED)

The issue is hard to reproduce in a standalone script. But anyhow

import abc
abc._get_dump

result in the same error (in Python 3.6), so I assume the workaround should have stayed?

  • 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.
@PidgeyBE PidgeyBE added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Jan 5, 2021
@simon-mo
Copy link
Contributor

simon-mo commented Jan 5, 2021

@suquark would you mind taking a look a this?
also @PidgeyBE can you list the typing package version if there is one? pip freeze | grep typing.

@PidgeyBE
Copy link
Contributor Author

PidgeyBE commented Jan 5, 2021

@simon-mo

# pip freeze | grep typing
typing-extensions==3.7.4.1

@PidgeyBE
Copy link
Contributor Author

PidgeyBE commented Jan 6, 2021

Additionally we see here that some _abc_ cache keys are popped before pickling serialization:

clsdict.pop('_abc_negative_cache', None)

but not all of them. Is there a reason e.g. _abc_generic_negative_cache and _abc_generic_negative_cache_version are not popped?
Because these keys/values are causing pickle issues in our use cases...

@suquark suquark self-assigned this Jan 6, 2021
@suquark
Copy link
Member

suquark commented Jan 6, 2021

_abc_generic_negative_cache and _abc_generic_negative_cache_version are likely generated by third-party libraries, and they do not exist in the python stdlib: https://github.com/python/cpython/blob/master/Lib/_py_abc.py.

we can hardcode these fields in cloudpickle as the workaround. Such issues would not be fully solved before python3.7 (where some patches are appiled), because python typing object has poor serialization support and failed a wide range of softwares: python/typing#511

@suquark suquark mentioned this issue Jan 6, 2021
6 tasks
@simon-mo
Copy link
Contributor

simon-mo commented Jan 7, 2021

The PR was merged. @PidgeyBE please try out latest master!

@PidgeyBE
Copy link
Contributor Author

PidgeyBE commented Jan 7, 2021

@simon-mo I've tested it on master and it works!

@hellofinch
Copy link

@simon-mo hello, the same bug came out in ray 2.0.0 with python 3.6. I tried to fix it as your PR shows. And it works. Maybe you can merge a PR again?

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 triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants