Repository navigation
Description
Apache Airflow version
2.1.4 (latest released)
Operating System
Linux
Versions of Apache Airflow Providers
adal==1.2.7
alembic==1.7.1
anyio==3.3.1
apache-airflow==2.1.4
apache-airflow-providers-ftp==2.0.1
apache-airflow-providers-http==2.0.1
apache-airflow-providers-imap==2.0.1
apache-airflow-providers-microsoft-azure==3.1.1
apache-airflow-providers-microsoft-mssql==2.0.1
apache-airflow-providers-odbc==2.0.1
apache-airflow-providers-postgres==2.2.0
apache-airflow-providers-slack==4.0.1
apache-airflow-providers-snowflake==2.1.1
apache-airflow-providers-sqlite==2.0.1
apache-airflow-providers-ssh==2.1.1
apispec==3.3.2
argcomplete==1.12.3
asn1crypto==1.4.0
attrs==20.3.0
azure-batch==11.0.0
azure-common==1.1.27
azure-core==1.18.0
azure-cosmos==3.2.0
azure-data-tables==12.1.0
azure-datalake-store==0.0.52
azure-identity==1.6.1
azure-keyvault==4.1.0
azure-keyvault-certificates==4.3.0
azure-keyvault-keys==4.4.0
azure-keyvault-secrets==4.3.0
azure-kusto-data==0.0.45
azure-mgmt-containerinstance==1.5.0
azure-mgmt-core==1.3.0
azure-mgmt-datafactory==1.1.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-resource==20.0.0
azure-nspkg==3.0.2
azure-storage-blob==12.8.1
azure-storage-common==2.1.0
azure-storage-file==2.1.0
Babel==2.9.1
bcrypt==3.2.0
blinker==1.4
boto3==1.17.112
botocore==1.20.112
cachetools==4.2.2
cattrs==1.5.0
certifi==2020.12.5
cffi==1.14.6
chardet==3.0.4
charset-normalizer==2.0.5
click==7.1.2
clickclick==20.10.2
colorama==0.4.4
colorlog==4.8.0
commonmark==0.9.1
croniter==1.0.15
cryptography==3.4.8
defusedxml==0.7.1
dill==0.3.1.1
dnspython==1.16.0
docutils==0.16
email-validator==1.1.3
eventlet==0.32.0
Flask==1.1.4
Flask-AppBuilder==3.3.3
Flask-Babel==1.0.0
Flask-Bcrypt==0.7.1
Flask-Caching==1.10.1
Flask-JWT-Extended==3.25.1
Flask-Login==0.4.1
Flask-OpenID==1.3.0
Flask-SQLAlchemy==2.5.1
Flask-WTF==0.14.3
furl==2.1.2
gevent==21.8.0
google-api-core==1.31.3
google-auth==1.35.0
googleapis-common-protos==1.53.0
graphviz==0.17
greenlet==1.1.1
gunicorn==20.1.0
h11==0.12.0
httpcore==0.13.7
httpx==0.19.0
idna==2.10
importlib-resources==1.5.0
inflection==0.5.1
iso8601==0.1.16
isodate==0.6.0
itsdangerous==1.1.0
Jinja2==2.11.3
jmespath==0.10.0
jsonschema==3.2.0
lazy-object-proxy==1.4.3
lockfile==0.12.2
Mako==1.1.5
Markdown==3.3.4
MarkupSafe==1.1.1
marshmallow==3.13.0
marshmallow-enum==1.5.1
marshmallow-oneofschema==3.0.1
marshmallow-sqlalchemy==0.23.1
msal==1.14.0
msal-extensions==0.3.0
msrest==0.6.21
msrestazure==0.6.4
ndg-httpsclient==0.5.1
numpy==1.20.3
oauthlib==3.1.1
openapi-schema-validator==0.1.5
openapi-spec-validator==0.3.1
opencensus==0.7.13
opencensus-context==0.1.2
opencensus-ext-azure==1.0.8
orderedmultidict==1.0.1
oscrypto==1.2.1
packaging==21.0
pandas==1.3.3
paramiko==2.7.2
pendulum==2.1.2
portalocker==1.7.1
prison==0.2.1
protobuf==3.17.3
psutil==5.8.0
psycopg2-binary==2.9.1
pyarrow==4.0.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pycryptodomex==3.10.1
Pygments==2.10.0
PyJWT==1.7.1
pymssql==2.2.2
PyNaCl==1.4.0
pyodbc==4.0.32
pyOpenSSL==20.0.1
pyparsing==2.4.7
pyrsistent==0.18.0
pysftp==0.2.9
python-daemon==2.3.0
python-dateutil==2.8.2
python-nvd3==0.15.0
python-slugify==4.0.1
python3-openid==3.2.0
pytz==2021.1
pytzdata==2020.1
PyYAML==5.4.1
requests==2.23.0
requests-oauthlib==1.3.0
rfc3986==1.5.0
rich==10.9.0
rsa==4.7.2
s3transfer==0.4.2
setproctitle==1.2.2
six==1.16.0
slack-sdk==3.11.0
sniffio==1.2.0
snowflake-connector-python==2.6.1
snowflake-ingest==1.0.4
snowflake-sqlalchemy==1.2.4
SQLAlchemy==1.3.24
SQLAlchemy-JSONField==1.0.0
SQLAlchemy-Utils==0.37.8
sshtunnel==0.1.5
swagger-ui-bundle==0.0.9
tabulate==0.8.9
tenacity==6.2.0
termcolor==1.1.0
text-unidecode==1.3
unicodecsv==0.14.1
urllib3==1.25.11
Werkzeug==1.0.1
WTForms==2.3.3
zope.event==4.5.0
zope.interface==5.4.0
Deployment
Other
Deployment details
Deployed to Azure App Service
What happened
Scheduler stopped running.
Got following error message: psycopg2.OperationalError: SSL SYSCALL error: EOF detected
What you expected to happen
All dags to run
How to reproduce
No response
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
hpatel-higi commentedon Oct 8, 2021
We just upgraded to version 2.1.4 from 1.10.8 and upgrade postgres to version 11. Issue happens in Azure App Service that uses Azuse Postgresql instance.
potiuk commentedon Oct 9, 2021
This is problem with long running queries and your deployment configuration (killing the connection after some time of inactivity) : Likely you can solve it via setting keep-alive on your connection https://stackoverflow.com/questions/24130305/postgres-ssl-syscall-error-eof-detected-with-python-and-psycopg
potiuk commentedon Oct 9, 2021
I realized that it was not entirely clear how to do it, so I added a new section to the documentation about it in #18850 . It would be great if you can see if following those docs fixes your problems @hpatel-higi
hpatel-higi commentedon Oct 11, 2021
I have made the changes just waiting on getting the code published. Once that has happened and ive tested this out i will let you know if it worked.
Add information about keepalives for managed Postgres (#18850)
hpatel-higi commentedon Oct 13, 2021
Still getting that error.
I set the sql_alchemy_connect_args values as such:
sql_alchemy_connect_args = log_config.KEEPALIVE_KWARGSInside log_config.py i have:
potiuk commentedon Oct 13, 2021
Then I think you need to do some more checking:
a) check if the keep alives are comming (I think you should find out in Postgres logs - they should be coming every 30 seconds). I am sure Postgres logging can be set in the way to show keepalives in logs (but I am not sure how to do it - not a postgres expert)
b) look in the logs of Postgres why maybe Postgres itself keeps on closing the connection (if it does close it - I suspected it's a firewall in between). There might be many reasons, memory problem, stale processes, lack of other resources, maximum timeouts set for query and so on. You should at least be ble to correlate the time when Airflow conection was closed and find corresponding log in Postgres server and match them - and maybe you will see who closed the connection (if you see both Postgres and Airflow seeing the "other" party to close the connection - this is likely something in between).
c) If you see keepalives coming, and see that both postgres and airflow see the connection killd, I would advise to see if there are maybe other settings in you network that kills an established, long runnning connection with keepalives - some enterprise firewall rules etc - eventually you migh need to involve Azure support to help with finding out what is this.
hpatel-higi commentedon Oct 13, 2021
I keep seeing this message over and over.
could not receive data from client: An existing connection was forcibly closed by the remote host.
potiuk commentedon Oct 13, 2021
Asume you see it in the Postgres DB logs? Then likely something in-between - some firewall likely. If both parties are seing the other party closed connection, then it must be the firewall. Maybe the keepalive configuration did not work for some reason (you need to double check if they are actually coming) or mayb the firewall is more aggressive.
One thing that COULD help a bit (though it would not likely address the root cause) is if you put PGBouncer between Airflow and Postgres DB (if you don't have it already). This is a recommended solution for Postgres (See the notes in "Setting Up the Database" https://airflow.apache.org/docs/apache-airflow/stable/howto/set-up-database.html?highlight=pgbouncer#setting-up-a-postgresql-database) and while it is unlikely it will cure the cause, if you put it close to Airflow and not behind the firewall, you might instead configure PGBouncer to do more aggressive KeepAlives and possibly even recover after connection is dropped.
hpatel-higi commentedon Oct 13, 2021
Also these are the server parameters that were set by default, do you know if these should match the keep_alive values?:
The other thing to note is that we never had issues like this before upgrading to 2.1.4 and upgrading postgres database to version 11 from 9.3. Could there be any other config value from airflow.cfg that could be causing this problem as well?
potiuk commentedon Oct 13, 2021
Not that I am aware of,
Add information about keepalives for managed Postgres (#18850)
hpatel-higi commentedon Oct 18, 2021
@potiuk so im getting a weird behavior now after adding the keep_alives args. Parent task in DAG succeeds but the subsequent task that should run after that task fail.
In the above image you can see the parent task is still running but it marked the subsequent tasks as failed already.
Here is the logs:
hpatel-higi commentedon Oct 18, 2021
This is also the other error we are getting now: