<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vaibhav Singh on Medium]]></title>
        <description><![CDATA[Stories by Vaibhav Singh on Medium]]></description>
        <link>https://medium.com/@vaibhavnsingh?source=rss-b06e7398981b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rINST_Gtv_Lj8oHNuuExXg.jpeg</url>
            <title>Stories by Vaibhav Singh on Medium</title>
            <link>https://medium.com/@vaibhavnsingh?source=rss-b06e7398981b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 01:10:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vaibhavnsingh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Optimizing Airflow Performance with PgBouncer: A Journey from Slowness to Stability]]></title>
            <link>https://medium.com/@vaibhavnsingh/optimizing-airflow-performance-with-pgbouncer-a-journey-from-slowness-to-stability-b7707784e9be?source=rss-b06e7398981b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7707784e9be</guid>
            <dc:creator><![CDATA[Vaibhav Singh]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 15:58:07 GMT</pubDate>
            <atom:updated>2024-11-22T16:03:40.753Z</atom:updated>
            <content:encoded><![CDATA[<p>When managing a large-scale Airflow deployment, database connection management can make or break your setup. In our case, we initially relied on SQLAlchemy’s default pooling mechanism provided by Airflow, but as the workload grew, so did our problems. In this article, I’ll share how we tackled slowness and connection exhaustion issues, our evaluation process for connection poolers, and how PgBouncer became the game-changer for our Airflow setup.</p><p><strong>The Problem: SQLAlchemy’s Connection Pooling Limitations</strong></p><p>At first, SQLAlchemy’s connection pool worked well for our needs. However, as the number of Airflow workers increased, we began facing serious issues:</p><ul><li><strong>Slowness</strong> in task execution.</li><li>Frequent <strong>connection exhaustion</strong> errors.</li></ul><p>Scaling the connection pool seemed like a logical solution at first. But as we added more workers, the database struggled to handle the increasing number of open connections. It became clear that we needed a more robust solution.</p><p><strong>Why Connection Poolers?</strong></p><p>Airflow’s documentation suggests using a connection pooler, and PgBouncer stood out as the first choice. We also briefly evaluated <strong>Pgpool-II</strong>, but based on Airflow’s recommendations and our specific use case, we opted for PgBouncer.</p><p><a href="https://airflow.apache.org/docs/apache-airflow/2.9.2/howto/set-up-database.html">Set up a Database Backend - Airflow Documentation</a></p><p><strong>Sample PgBouncer Setup</strong></p><pre>pool_mode = session<br>default_pool_size = 150<br>server_idle_timeout = 300<br>server_connect_timeout = 60<br>client_idle_timeout = 300</pre><p>This configuration worked well initially, stabilizing our system and resolving the slowness issues.</p><p><strong>The New Problem: Pool Exhaustion</strong></p><p>After some time, we encountered a new error:</p><pre>pooler error: query_wait_timeout</pre><p>This error occurred when the database query wait time exceeded 120 seconds because sessions in the pool were not released. On deeper analysis, we found the root cause: <strong>Airflow queries were leaving sessions open without utilizing them</strong>, gradually exhausting the available pool connections.</p><p><strong>The Solution: Changing </strong><strong>pool_mode to </strong><strong>transaction</strong></p><p>The culprit turned out to be our pool_mode setting. We initially used pool_mode = session, which dedicates a database connection to a client for the entire session, even when idle. This mode is less efficient for systems like Airflow that can run many queries in a short span.</p><p>To address this, we changed:</p><pre>pool_mode = transaction</pre><p>In transaction mode, connections are allocated only for the duration of a transaction, making them available to other clients immediately afterward. This change resolved the pool exhaustion issue entirely, ensuring efficient utilization of database connections.</p><p><strong>Key PgBouncer Parameters to Explore</strong></p><p>Here are some essential PgBouncer parameters that can be tuned based on your use case:</p><ul><li><strong>pool_mode</strong><br>Determines how connections are pooled. Options: session, transaction, statement.<br>Use transaction for Airflow unless there&#39;s a strong need for session.</li><li><strong>max_client_conn</strong><br>The maximum number of client connections PgBouncer can handle.</li><li><strong>default_pool_size</strong><br>The number of server connections PgBouncer keeps per database/user pair.</li><li><strong>min_pool_size</strong><br>The minimum number of server connections PgBouncer keeps in the pool.</li><li><strong>server_idle_timeout</strong><br>Disconnects idle server connections after this timeout.</li><li><strong>server_connect_timeout</strong><br>Timeout for connecting to the server.</li><li><strong>client_idle_timeout</strong><br>Disconnects idle client connections after this timeout.</li></ul><p>For a full list of parameters and their descriptions, refer to the</p><p><a href="https://www.pgbouncer.org/config.html">PgBouncer config</a></p><p><strong>The Impact</strong></p><p>Switching to PgBouncer with optimized settings made our Airflow deployment:</p><ul><li><strong>Faster</strong>: Query execution times improved drastically.</li><li><strong>Stable</strong>: No more slowness or connection exhaustion errors.</li><li><strong>Scalable</strong>: Easily managed the growing number of Airflow workers without overburdening the database.</li></ul><p><strong>Final Thoughts</strong></p><p>Integrating a connection pooler like PgBouncer is a must for managing Airflow at scale. While PgBouncer’s default settings work well for many cases, fine-tuning parameters like pool_mode and pool sizes is critical to meet your specific needs.</p><p>If you’re encountering similar issues with your Airflow setup, consider PgBouncer. With proper configuration, it can save you from the headaches of database connection management and take your system’s performance to the next level.</p><p>Have you faced connection pooling issues in Airflow? Share your experience in the comments!</p><p><strong>Happy scheduling!</strong> 🎉</p><p>#Airflow #PgBouncer #DatabaseOptimization #ConnectionPooling #CloudEngineering #DevOps #Scalability #PerformanceTuning #DatabaseManagement #DataEngineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7707784e9be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resolving Airflow SSH Command Timeout Issue: A Solution to AirflowException(“SSH command timed…]]></title>
            <link>https://medium.com/@vaibhavnsingh/resolving-airflow-ssh-command-timeout-issue-a-solution-to-airflowexception-ssh-command-timed-7ca7fb957b79?source=rss-b06e7398981b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ca7fb957b79</guid>
            <dc:creator><![CDATA[Vaibhav Singh]]></dc:creator>
            <pubDate>Thu, 14 Nov 2024 16:48:33 GMT</pubDate>
            <atom:updated>2024-11-14T16:48:33.841Z</atom:updated>
            <content:encoded><![CDATA[<h3>Resolving Airflow SSH Command Timeout Issue: A Solution to AirflowException(“SSH command timed out”)</h3><p><strong>Introduction</strong></p><p>We recently encountered an intermittent issue with Airflow’s SSHOperator when running a Bash script on a remote Linux server. The error</p><pre>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/ssh/operators/ssh.py&quot;, line 176, in run_ssh_client_command<br>    exit_status, agg_stdout, agg_stderr = self.hook.exec_ssh_client_command(<br>                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/ssh/hooks/ssh.py&quot;, line 554, in exec_ssh_client_command<br>    raise AirflowException(&quot;SSH command timed out&quot;)<br>airflow.exceptions.AirflowException: SSH command timed out</pre><p>started appearing unexpectedly and disrupted our workflow. After some investigation, we found the root cause was related to Airflow’s default timeout settings for SSH commands.</p><h4>Root Cause: Default Timeout Setting</h4><p>Airflow’s SSHOperator and SSHHook both have a cmd_timeout property that defines how long Airflow will wait for an SSH command to complete. By default, this timeout is set to <strong>10 seconds</strong>. If the SSH command takes longer than the specified cmd_timeout, Airflow raises a timeout error. For a detailed overview of all available properties for both the SSHOperator and SSHHook, refer to the official Airflow documentation:</p><p><a href="https://airflow.apache.org/docs/apache-airflow-providers-ssh/stable/_api/airflow/providers/ssh/hooks/ssh/index.html#airflow.providers.ssh.hooks.ssh.SSHHook">https://airflow.apache.org/docs/apache-airflow-providers-ssh/stable/_api/airflow/providers/ssh/hooks/ssh/index.html#airflow.providers.ssh.hooks.ssh.SSHHook</a></p><p>Our Bash script occasionally took more than 10 seconds to complete, especially during periods of high network latency or heavy processing. This led to the timeout error.</p><h4>Solution: Increase cmd_timeout</h4><p>To fix this, we increased the cmd_timeout from 10 seconds to <strong>60 seconds</strong>, allowing more time for the script to run and preventing the timeout error. Here&#39;s how we updated the parameter in our DAG:</p><pre>from airflow.providers.ssh.hooks.ssh import SSHHook<br>from airflow.providers.ssh.operators.ssh import SSHOperator<br><br>ssh_command = SSHOperator(<br>    task_id=&#39;run_bash_script&#39;,<br>    ssh_hook= SSHHook(ssh_conn_id=&#39;my_ssh_connection&#39;, cmd_timeout=60),<br>    command=&#39;/path/to/my_bash_script.sh&#39;<br>)</pre><h3>Additional Timeout Properties</h3><p>While cmd_timeout was the main issue, we also reviewed other timeout settings, like connect_timeout and command_timeout, to ensure they were appropriate for our network conditions.</p><pre>ssh_command = SSHOperator(<br>    task_id=&#39;run_bash_script&#39;,<br>    ssh_conn_id=&#39;my_ssh_connection&#39;,<br>    command=&#39;/path/to/my_bash_script.sh&#39;,<br>    cmd_timeout=60,<br>    connect_timeout=30,  # Reasonable connection timeout<br>    command_timeout=60 # Matches cmd_timeout<br>)</pre><h3>Conclusion</h3><p>Increasing the cmd_timeout solved our problem with SSH command timeouts. If you encounter similar issues, adjusting this value based on your network latency and script execution time can help prevent task failures.</p><p><strong>Key Takeaways:</strong></p><ul><li>Airflow’s default cmd_timeout of 10 seconds can be too short for some tasks.</li><li>Adjust cmd_timeout (and other timeout properties) to suit your task&#39;s execution time.</li><li>A 60-second timeout resolved our issue and ensured consistent task execution.</li></ul><p>By applying these changes, we’ve avoided the timeout errors and have been able to run our tasks smoothly.</p><p>#Airflow #ApacheAirflow #SSH #DevOps #Automation #CloudComputing #DataEngineering #Python #CI_CD #ETL #CloudArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ca7fb957b79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rethinking Airflow: A Unique Approach to Scheduling with Static DAGs]]></title>
            <link>https://medium.com/@vaibhavnsingh/airflow-71df569692c8?source=rss-b06e7398981b------2</link>
            <guid isPermaLink="false">https://medium.com/p/71df569692c8</guid>
            <dc:creator><![CDATA[Vaibhav Singh]]></dc:creator>
            <pubDate>Tue, 22 Oct 2024 17:54:15 GMT</pubDate>
            <atom:updated>2024-10-22T18:10:42.053Z</atom:updated>
            <content:encoded><![CDATA[<p>#Airflow #DagProcessor</p><p>Apache Airflow is a powerful tool for orchestrating complex workflows, typically relying on its Dynamic Directed Acyclic Graphs (DAGs) to manage tasks. However, in my recent project, I encountered a scenario where our use case deviated significantly from the conventional applications of Airflow. We needed to use Airflow as a scheduler for a substantial number of static DAGs, presenting a unique set of challenges. In this article, I’ll share our journey, the obstacles we faced, and the innovative solution we implemented.</p><h3>The Challenge of Static DAGs</h3><p>In traditional Airflow setups, the DAG Processor plays a crucial role by scanning the filesystem for DAG definitions and publishing them at regular intervals. This mechanism ensures that any updates to DAG files are reflected promptly, allowing users to leverage the latest workflows without delays. However, our project had a different requirement: we needed a large volume of static DAGs that would not need reprocessing.</p><p>The primary concern here was performance. With hundreds of DAGs and the overhead of constantly scanning and refreshing them, we quickly realized that relying on the DAG Processor would introduce unnecessary load on our Airflow scheduler. We needed a solution that could accommodate our unique needs without the typical complexities associated with dynamic DAGs.</p><h3>The Solution: Manual Publishing of Static DAGs</h3><p>After extensive analysis and discussions within our team, we arrived at a straightforward yet effective solution: we would eliminate the DAG Processor from our Airflow stack entirely. Instead of relying on automated scanning and publishing, we opted for a manual publishing approach on demand.</p><p>To implement this, we followed these steps:</p><ul><li><strong>Static DAG Creation</strong>: When creating a DAG, we would publish it once</li><li><strong>Disabling the DAG Processor</strong>: By not spinning up the DAG Processor pod, we effectively removed its service from our architecture. This adjustment allowed us to sidestep the overhead associated with managing a dynamic DAG environment. We added a necessary property in our Airflow configuration to remove DAG Processor</li></ul><pre>AIRFLOW__SCHEDULER__STANDALONE_DAG_PROCESSOR=True</pre><ul><li><strong>Manual Publishing</strong>: Whenever we needed to introduce a new DAG or modify an existing one, we would manually publish the DAG. The same code utilised by the DAG Processor for publishing was employed here, but without the need for continuous monitoring.</li></ul><p><a href="https://github.com/apache/airflow/blob/main/airflow/dag_processing/processor.py">airflow/airflow/dag_processing/processor.py at main · apache/airflow</a></p><p>This method allowed us to efficiently manage our large number of static DAGs without overwhelming the scheduler, effectively streamlining our workflow management.</p><h3>The Benefits of Our Approach</h3><p>This reconfiguration yielded several benefits:</p><ul><li><strong>Reduced Load</strong>: By removing the DAG Processor, we alleviated significant pressure on the scheduler, enabling it to focus on task execution rather than constant DAG management.</li><li><strong>Simplicity and Control</strong>: Manual publishing provided us with greater control over our DAGs, allowing us to make changes only when necessary and reducing the risk of unintentional modifications.</li><li><strong>Scalability</strong>: Our approach was easily scalable, accommodating the addition of new static DAGs without the complications of a dynamic system.</li></ul><h3>Conclusion</h3><p>While Apache Airflow is traditionally viewed as a tool for dynamic workflows, our experience demonstrates its flexibility in handling static DAGs. By rethinking how we employed Airflow in our architecture, we successfully navigated the challenges posed by a large volume of static workflows.</p><p>This journey taught us the importance of adapting tools to fit specific use cases rather than forcing a one-size-fits-all solution. For anyone dealing with similar requirements, I hope our approach inspires you to explore creative solutions within your own Airflow implementations.</p><p>Feel free to reach out with any questions or to share your own experiences with Airflow!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71df569692c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding and Fixing the Airflow Task Timeout Error]]></title>
            <link>https://medium.com/@vaibhavnsingh/understanding-and-fixing-the-airflow-task-timeout-error-8df3bf326e63?source=rss-b06e7398981b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8df3bf326e63</guid>
            <dc:creator><![CDATA[Vaibhav Singh]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 17:40:52 GMT</pubDate>
            <atom:updated>2024-10-15T17:40:52.500Z</atom:updated>
            <content:encoded><![CDATA[<p>#Airflow #AirflowTaskTimeout</p><p>Upgrading Airflow can bring many improvements, but sometimes, unexpected issues can surface. Recently, I ran into a problem after upgrading to Airflow 2.9.2 in one of my environments. Here’s the story of how I faced the airflow.exceptions.AirflowTaskTimeout error, the impact it had on my scheduler, and how I ultimately fixed it.</p><h4>The Setup: Multiple Environments Running Smoothly</h4><p>In our setup, we have Airflow running across three different environments, all working seamlessly. Each environment handled hundreds of DAGs daily, and everything was fine after upgrading to version 2.9.2.</p><p>However, one day, in one of our environments, things started going wrong.</p><h4>The Unexpected Error</h4><p>Out of nowhere, we encountered the following error in the logs:</p><pre>[2024-09-23T12:30:57.595+0000] {settings.py:363} DEBUG - Disposing DB connection pool (PID 7)<br>    self._process_tasks(task_tuples)<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/celery/executors/celery_executor.py&quot;, line 281, in _process_tasks<br>    key_and_async_results = self._send_tasks_to_celery(task_tuples_to_send)<br>                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/celery/executors/celery_executor.py&quot;, line 323, in _send_tasks_to_celery<br>    return list(map(send_task_to_executor, task_tuples_to_send))<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/celery/executors/celery_executor_utils.py&quot;, line 199, in send_task_to_executor<br>    result = task_to_run.apply_async(args=[command], queue=queue)<br>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/celery/app/task.py&quot;, line 594, in apply_async<br>    return app.send_task(<br>           ^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/celery/app/base.py&quot;, line 801, in send_task<br>    amqp.send_task_message(P, name, message, **options)<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/celery/app/amqp.py&quot;, line 518, in send_task_message<br>    ret = producer.publish(<br>          ^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/messaging.py&quot;, line 186, in publish<br>    return _publish(<br>           ^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/connection.py&quot;, line 556, in _ensured<br>    return fun(*args, **kwargs)<br>           ^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/messaging.py&quot;, line 202, in _publish<br>    [maybe_declare(entity) for entity in declare]<br>     ^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/messaging.py&quot;, line 107, in maybe_declare<br>    return maybe_declare(entity, self.channel, retry, **retry_policy)<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/common.py&quot;, line 113, in maybe_declare<br>    return _maybe_declare(entity, channel)<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/common.py&quot;, line 153, in _maybe_declare<br>    entity.declare(channel=channel)<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/entity.py&quot;, line 617, in declare<br>    self._create_queue(nowait=nowait, channel=channel)<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/entity.py&quot;, line 628, in _create_queue<br>    self.queue_bind(nowait=nowait, channel=channel)<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/entity.py&quot;, line 672, in queue_bind<br>    return self.bind_to(self.exchange, self.routing_key,<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/kombu/entity.py&quot;, line 681, in bind_to<br>    return (channel or self.channel).queue_bind(<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/channel.py&quot;, line 939, in queue_bind<br>    return self.send_method(<br>           ^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/abstract_channel.py&quot;, line 79, in send_method<br>    return self.wait(wait, returns_tuple=returns_tuple)<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/abstract_channel.py&quot;, line 99, in wait<br>    self.connection.drain_events(timeout=timeout)<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/connection.py&quot;, line 526, in drain_events<br>    while not self.blocking_read(timeout):<br>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/connection.py&quot;, line 531, in blocking_read<br>    frame = self.transport.read_frame()<br>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/transport.py&quot;, line 294, in read_frame<br>    frame_header = read(7, True)<br>                   ^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/amqp/transport.py&quot;, line 629, in _read<br>    s = recv(n - len(rbuf))<br>        ^^^^^^^^^^^^^^^^^^^<br>  File &quot;/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/timeout.py&quot;, line 69, in handle_timeout<br>    raise AirflowTaskTimeout(self.error_message)<br>airflow.exceptions.AirflowTaskTimeout: Timeout, PID: 7</pre><p>This wasn’t just any error — it completely disrupted our environment. Soon, we noticed that our Airflow scheduler was going into a <strong>crashback loop</strong>. This led to frequent and uncommon restarts of Airflow, causing task failures and unplanned downtime.</p><h3>Debugging the Issue</h3><p>During debugging, we narrowed the problem down to this specific error. But what puzzled us was that the error didn’t appear in our other two environments, despite them being configured the same way. So why was only one environment impacted?</p><h3>The Cause: A Timeout Setting Limiting Task Execution</h3><p>After hours of digging through logs, configuration files, and multiple test runs, we discovered that <strong>Airflow</strong> has a property called A (specific property name), which governs how long the scheduler can take to perform certain operations. This property has a default timeout value of <strong>1.0 seconds</strong>.</p><p>In our failing environment, the scheduler was taking slightly longer than the default time of 1.0 seconds to publish tasks. As a result, it kept hitting this timeout limit, leading to repeated failures and restarts.</p><h3>The Solution: Tweaking the Timeout Setting</h3><p>Once we understood the problem, the fix became clear. We needed to increase the timeout value for this property. To do this, we added a new environment variable in our Airflow configuration:</p><pre>AIRFLOW__CELERY__OPERATION_TIMEOUT=10.0</pre><p>This change extended the timeout to 10 seconds, giving the scheduler enough time to perform its tasks without hitting the timeout limit.</p><h3>Results: Stability Restored</h3><p>After implementing this change, the issue was resolved. The scheduler stopped going into crashback loops, and the tasks began to execute smoothly again.</p><h3>Key Takeaways</h3><ol><li><strong>Time-sensitive properties in Airflow can cause unexpected failures</strong>, especially when dealing with long-running tasks or performance-heavy operations.</li><li><strong>Default timeout values might be too low for certain environments</strong>. In this case, the default of 1.0 seconds wasn’t sufficient for our setup.</li><li><strong>Environment-specific issues can occur even with identical setups</strong>. In our situation, only one environment was impacted, possibly due to differences in resource allocation or workload.</li></ol><h3>Solution Recap: Adjusting Timeout Settings</h3><p>If you’re encountering similar issues with Airflow, especially around the AirflowTaskTimeout error or scheduler crashes, here’s the solution in a nutshell:</p><ol><li>Identify if your scheduler is failing due to timeout issues by checking the logs.</li><li>Locate the specific property causing the issue. In our case, it was the AIRFLOW__CELERY__OPERATION_TIMEOUT.</li><li>Modify the timeout setting to a higher value:</li></ol><pre>AIRFLOW__CELERY__OPERATION_TIMEOUT=&lt;new_value&gt;</pre><p>4. Restart your Airflow services to apply the changes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8df3bf326e63" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>