<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.6.2</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">I install Airflow with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pip install apache-airflow['postgresql']
pip install psycopg2-binary
# airflow.cfg: executor = LocalExecutor
# airflow.cfg: sql_alchemy_conn = postgresql+psycopg2://airflow:airflow@localhost/airflow
airflow db init"><pre class="notranslate"><code class="notranslate">pip install apache-airflow['postgresql']
pip install psycopg2-binary
# airflow.cfg: executor = LocalExecutor
# airflow.cfg: sql_alchemy_conn = postgresql+psycopg2://airflow:airflow@localhost/airflow
airflow db init
</code></pre></div>
<p dir="auto">Last week everything was fine. Today, on a fresh installation, the last command fails with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DB: postgresql+psycopg2://airflow:***@localhost/airflow
/home/adminuser/pyairflow/lib/python3.9/site-packages/pydantic/_internal/_config.py:257 UserWarning: Valid config keys have changed in V2:
* 'orm_mode' has been renamed to 'from_attributes'
Traceback (most recent call last):
  File &quot;/home/adminuser/pyairflow/bin/airflow&quot;, line 8, in &lt;module&gt;
    sys.exit(main())
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/__main__.py&quot;, line 48, in main
    args.func(args)
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/cli/cli_config.py&quot;, line 52, in command
    return func(*args, **kwargs)
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/cli/commands/db_command.py&quot;, line 37, in initdb
    db.initdb()
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/utils/session.py&quot;, line 76, in wrapper
    return func(*args, session=session, **kwargs)
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/utils/db.py&quot;, line 711, in initdb
    import_all_models()
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/models/__init__.py&quot;, line 60, in import_all_models
    __getattr__(name)
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/models/__init__.py&quot;, line 78, in __getattr__
    val = import_string(f&quot;{path}.{name}&quot;)
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/utils/module_loading.py&quot;, line 36, in import_string
    module = import_module(module_path)
  File &quot;/usr/lib/python3.9/importlib/__init__.py&quot;, line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1030, in _gcd_import
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1007, in _find_and_load
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 986, in _find_and_load_unlocked
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 680, in _load_unlocked
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 790, in exec_module
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 228, in _call_with_frames_removed
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/models/skipmixin.py&quot;, line 25, in &lt;module&gt;
    from airflow.serialization.pydantic.dag_run import DagRunPydantic
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/serialization/pydantic/dag_run.py&quot;, line 24, in &lt;module&gt;
    from airflow.serialization.pydantic.dataset import DatasetEventPydantic
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/serialization/pydantic/dataset.py&quot;, line 40, in &lt;module&gt;
    class TaskOutletDatasetReferencePydantic(BaseModelPydantic):
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py&quot;, line 95, in __new__
    private_attributes = inspect_namespace(
  File &quot;/home/adminuser/pyairflow/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py&quot;, line 328, in inspect_namespace
    raise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `dag_id = &lt;class 'str'&gt;`. All model fields require a type annotation; if `dag_id` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.

For further information visit https://errors.pydantic.dev/2.0/u/model-field-missing-annotation"><pre class="notranslate"><code class="notranslate">DB: postgresql+psycopg2://airflow:***@localhost/airflow
/home/adminuser/pyairflow/lib/python3.9/site-packages/pydantic/_internal/_config.py:257 UserWarning: Valid config keys have changed in V2:
* 'orm_mode' has been renamed to 'from_attributes'
Traceback (most recent call last):
  File "/home/adminuser/pyairflow/bin/airflow", line 8, in &lt;module&gt;
    sys.exit(main())
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/__main__.py", line 48, in main
    args.func(args)
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/cli/cli_config.py", line 52, in command
    return func(*args, **kwargs)
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/cli/commands/db_command.py", line 37, in initdb
    db.initdb()
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/utils/session.py", line 76, in wrapper
    return func(*args, session=session, **kwargs)
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/utils/db.py", line 711, in initdb
    import_all_models()
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/models/__init__.py", line 60, in import_all_models
    __getattr__(name)
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/models/__init__.py", line 78, in __getattr__
    val = import_string(f"{path}.{name}")
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/utils/module_loading.py", line 36, in import_string
    module = import_module(module_path)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "&lt;frozen importlib._bootstrap&gt;", line 1030, in _gcd_import
  File "&lt;frozen importlib._bootstrap&gt;", line 1007, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 986, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 680, in _load_unlocked
  File "&lt;frozen importlib._bootstrap_external&gt;", line 790, in exec_module
  File "&lt;frozen importlib._bootstrap&gt;", line 228, in _call_with_frames_removed
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/models/skipmixin.py", line 25, in &lt;module&gt;
    from airflow.serialization.pydantic.dag_run import DagRunPydantic
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/serialization/pydantic/dag_run.py", line 24, in &lt;module&gt;
    from airflow.serialization.pydantic.dataset import DatasetEventPydantic
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/airflow/serialization/pydantic/dataset.py", line 40, in &lt;module&gt;
    class TaskOutletDatasetReferencePydantic(BaseModelPydantic):
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 95, in __new__
    private_attributes = inspect_namespace(
  File "/home/adminuser/pyairflow/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 328, in inspect_namespace
    raise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `dag_id = &lt;class 'str'&gt;`. All model fields require a type annotation; if `dag_id` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.

For further information visit https://errors.pydantic.dev/2.0/u/model-field-missing-annotation
</code></pre></div>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">The db init used to complete without any issue, on a clean Debian VM just like the one I'm testing on.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">In a fresh Azure VM with Debian 11 I use this script:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo -u postgres psql -c &quot;CREATE USER airflow PASSWORD 'airflow';&quot;
sudo -u postgres psql -c &quot;CREATE DATABASE airflow;&quot;
sudo -u postgres psql -c &quot;GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO airflow;&quot;

python3 -m venv ~/pyairflow
echo 'alias afpip=&quot;~/pyairflow/bin/pip3&quot;' &gt;&gt; ~/.bash_profile
echo 'alias afpython=&quot;~/pyairflow/bin/python3&quot;' &gt;&gt; ~/.bash_profile
source ~/.bash_profile
afpip install apache-airflow['postgresql']
afpip install psycopg2-binary

airflow &gt; /dev/null 2&gt;&amp;1
mv ~/airflow/airflow.cfg ~/airflow/airflow.cfg.orig
cat ~/airflow/airflow.cfg.orig | sed -e 's/^executor =.*$/executor = LocalExecutor/g' | sed -e 's/^sql_alchemy_conn =.*$/sql_alchemy_conn = postgresql+psycopg2:\/\/airflow:airflow@localhost\/airflow/g' &gt; ~/airflow/airflow.cfg

airflow db init"><pre class="notranslate"><code class="notranslate">sudo -u postgres psql -c "CREATE USER airflow PASSWORD 'airflow';"
sudo -u postgres psql -c "CREATE DATABASE airflow;"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO airflow;"

python3 -m venv ~/pyairflow
echo 'alias afpip="~/pyairflow/bin/pip3"' &gt;&gt; ~/.bash_profile
echo 'alias afpython="~/pyairflow/bin/python3"' &gt;&gt; ~/.bash_profile
source ~/.bash_profile
afpip install apache-airflow['postgresql']
afpip install psycopg2-binary

airflow &gt; /dev/null 2&gt;&amp;1
mv ~/airflow/airflow.cfg ~/airflow/airflow.cfg.orig
cat ~/airflow/airflow.cfg.orig | sed -e 's/^executor =.*$/executor = LocalExecutor/g' | sed -e 's/^sql_alchemy_conn =.*$/sql_alchemy_conn = postgresql+psycopg2:\/\/airflow:airflow@localhost\/airflow/g' &gt; ~/airflow/airflow.cfg

airflow db init
</code></pre></div>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Linux Debian 11, an Azure VM</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto">apache-airflow-providers-common-sql==1.5.2<br>
apache-airflow-providers-ftp==3.4.2<br>
apache-airflow-providers-http==4.4.2<br>
apache-airflow-providers-imap==3.2.2<br>
apache-airflow-providers-sqlite==3.4.2</p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Virtualenv installation</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto">As above</p>
<h3 dir="auto">Anything else</h3>
<p dir="auto">Same problem should be reported <a href="https://www.reddit.com/r/apache_airflow/comments/14oji77/airflow_262_and_pydantic_warningserrors/" rel="nofollow">here</a>.</p>
<p dir="auto">I am not an expert in python :-(</p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<p dir="auto"><strong>Apache Airflow version</strong>:</p>
<p dir="auto">2.0.2</p>
<p dir="auto"><strong>Kubernetes version (if you are using kubernetes)</strong> (use <code class="notranslate">kubectl version</code>):</p>
<p dir="auto">1.19.7</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li>Azure AKS</li>
<li>Azure Postgresql</li>
<li>Bitnami template</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">Scheduler stopped running after processing a dag at 00:30.  Next dags at 00:45 did not get executed.</p>
<p dir="auto">Errors relating to postgres in the log:</p>
<p dir="auto">sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) SSL SYSCALL error: EOF detected</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">All dags run.</p>
<p dir="auto"><strong>Anything else we need to know</strong>:</p>
<p dir="auto">Full scheduler pod logs:</p>
<p dir="auto"><a href="https://github.com/apache/airflow/files/6814563/broken_scheduler_edit.txt">broken_scheduler_edit.txt</a></p>