-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Dill fails to serialize context in Python 3.11 correctly #35307
Comments
cc: @jens-scheffler-bosch, @ashb @uranusjr @Taragolis @bolkedebruin -> this one needs someone who they know their ways around dill and serialization :). It's Python 3.11 only and we had already a weird issue that Pytest assert rewrite was breaking this tests for other Python versions so we run it as separate type with Rather arcane thing, but I believe context serialization is broken currently for |
Detected it while improving our test suite - I found out that we have not run the |
Assumption 1Maybe it happen because we use dill==0.3.1.1.1 which was released at Sep 28, 2019 and Python 3.11 was released Oct 24, 2022? root@567a6cdeef08:/opt/airflow# pipdeptree --packages dill -r
Warning!! Cyclic dependencies found:
* sphinxcontrib-applehelp => sphinx => sphinxcontrib-applehelp
* sphinxcontrib-devhelp => sphinx => sphinxcontrib-devhelp
* sphinxcontrib-htmlhelp => sphinx => sphinxcontrib-htmlhelp
* sphinxcontrib-qthelp => sphinx => sphinxcontrib-qthelp
* sphinxcontrib-serializinghtml => sphinx => sphinxcontrib-serializinghtml
* sphinx => sphinxcontrib-applehelp => sphinx
------------------------------------------------------------------------
dill==0.3.1.1
├── apache-airflow==2.8.0.dev0 [requires: dill>=0.2.2]
└── apache-beam==2.51.0 [requires: dill>=0.3.1.1,<0.3.2] Ok, let's break dependencies, install dill==0.3.7 and have a look what is happen warnings summary:
============================
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> connexion/decorators/validation.py:16 DeprecationWarning('Accessing jsonschema.draft4_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> connexion/json_schema.py:16 DeprecationWarning('jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> connexion/json_schema.py:17 DeprecationWarning('jsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> dill/_dill.py:412 PicklingWarning('Cannot locate reference to <class 'pendulum.duration.Duration'>.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> dill/_dill.py:412 PicklingWarning('Cannot pickle <class 'pendulum.duration.Duration'>: pendulum.duration.Duration has recursive self-references that trigger a RecursionError.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> dill/_dill.py:412 PicklingWarning('Cannot locate reference to <class 'pendulum.datetime.DateTime'>.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> dill/_dill.py:412 PicklingWarning('Cannot pickle <class 'pendulum.datetime.DateTime'>: pendulum.datetime.DateTime has recursive self-references that trigger a RecursionError.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> dill/_dill.py:412 PicklingWarning('Cannot locate reference to <class 'pendulum.time.Time'>.')
tests/operators/test_python.py::TestPythonVirtualenvOperator.test_airflow_context:1004
-> dill/_dill.py:412 PicklingWarning('Cannot pickle <class 'pendulum.time.Time'>: pendulum.time.Time has recursive self-references that trigger a RecursionError.')
All Warning errors can be found in the warnings.txt file.
============================================================================== short test summary info ==============================================================================
FAILED tests/operators/test_python.py::TestPythonVirtualenvOperator::test_airflow_context - subprocess.CalledProcessError: Command '['/tmp/venvngz2drh_/bin/python', '/tmp/venvngz2drh_/script.py', '/tmp/venvngz2drh_/script.in', '/tmp/venvngz2drh_/script.out', '/tmp/venvngz2drh_/string_args.txt', '/tmp/venvngz2drh_/termination.log']' returned non-zero exit status 1.
================================================================================= 1 failed in 6.54s =================================================================================
root@6c8587e657c9:/opt/airflow#
Assumption 2Hmm, in the new version I could clearly see the warnings about pendulum. Let's try pendulum 3.0.0b1, for allow run Airflow with this version I switched to #34744 And with combination of
If return any of this packages back then test failed |
Yes. It's very likely about old version and pendulum. Unfortunately beam is rather tightly pinning dill:
And yes 0.3.7 is the first one that has 3.11 support. bad news 0.3.7 does not solve it either :( |
Maybe it is a good time to think about old issue #7870 |
Yeah. Why not :) |
If you don't need Airflow context you can try to pass
|
pip uninstall dill
pip install dill
``
dill-0.3.9 solved my issue. |
Experienced same issue. This saved my day! |
Body
There is a regression that needs investigation. One of our tests is failing only on Python 3.11
tests/operators/test_python.py::TestPythonVirtualenvOperator::test_airflow_context
This test is part of PlainAssert suite and it has been skipped so far but after #35160 the PlainAssert (having only that test) have been brought back to regular tests and it turned out that it fails for Python 3.11
The error is about dill serializing the context:
And likely connected with similar issues reported by others.
The way how to reproduce it:
breeze --python 3.11
or PY311
in(Note - for this test assert rewriting in Pytest must be disabled that's why we have the ENV variable and --assert=plain`.
Example failure: https://github.com/apache/airflow/actions/runs/6710410150/job/18236357337 (and you can see that Python 3.8 - 3.10 are all green, only Python 3.11 is affected).
Committer
The text was updated successfully, but these errors were encountered: