【问题标题】:apache airflow 1.10.9 statsd enabled making scheduler crashed启用 apache 气流 1.10.9 statsd 使调度程序崩溃
【发布时间】:2020-02-28 06:59:36
【问题描述】:

我的气流在 CeleryExecutor 模式 + progresql 12 下运行,除了打开 statsd 时,一切都很顺利:

statsd_on = True
statsd_host = localhost
statsd_port = 8125
statsd_prefix = airflow

调度器可以渲染作业但作业没有运行,调度器日志有以下错误:

[SQL: SELECT count(*) AS count_1 
FROM task_instance 
WHERE task_instance.pool = %(pool_1)s AND task_instance.state IN (%(state_1)s, %(state_2)s)]
[parameters: {'pool_1': 'default_pool', 'state_1': 'running', 'state_2': 'queued'}]
(Background on this error at: http://sqlalche.me/e/4xp6)[0m
[31mTraceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1246, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.ProtocolViolation: invalid frontend message type 97
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/airflow/jobs/scheduler_job.py", line 1495, in _validate_and_run_task_instances
    self._process_and_execute_tasks(simple_dag_bag)

  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.DatabaseError: (psycopg2.errors.ProtocolViolation) invalid frontend message type 97
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

如果禁用 statsd,一切都会恢复。这是气流的错误吗?有什么建议可以解决吗?

【问题讨论】:

    标签: airflow statsd


    【解决方案1】:

    我遇到了同样的错误,经过几次测试,我可以让 statsd 指标正常工作。通常,如果满足以下条件,您将看到错误。

    • Statsd enabled 设置为 True
    • SqlAlchemy 连接池设置为 True
    • 已启用调度程序 syserr 日志(通过将 err 日志重定向到可以看到此错误的文件)

    在我的例子中,即使调度程序不断抛出错误日志,statsd 指标仍然被传递,并且任务也被安排好了。我不知道如何衡量影响,我也不想牺牲 sql_alchemy 连接池,所以我关闭了 statsd。

    我猜其他人没有看到错误,因为他们错过了上面的第三个

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-20
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多