# Is there a way to increase the workflow deadlock detection timeout from the default 2 seconds? in python\_sdk

**URL:** <https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256>\
**Category:** Community Support\
**Tags:** python-sdk\
**Created:** [August 22, 2025, 12:24pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256 "2025-08-22T12:24:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Santa\_Claus\_2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/santa_claus_2/32/6763_2.png) [@Santa\_Claus\_2](https://community.temporal.io/u/Santa_Claus_2)\
**Post date:** [August 22, 2025, 12:24pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/1 "2025-08-22T12:24:10Z")

</div>

I’m getting [TMPRL1101] Potential deadlock detected: workflow didn’t yield within 2 second(s) and need a bit more time for some operations in my workflow interceptor.

Any configuration options or environment variables I can set?

* * *

Use case: Implementing distributed locking in workflow interceptors to limit concurrent activities across multiple workflow instances (e.g., max 5 database-heavy activities running simultaneously). The Redis calls for lock acquisition occasionally take \>2s, triggering the deadlock detection.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 22, 2025, 6:20pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/2 "2025-08-22T18:20:27Z")

</div>

Use local activities for this. Direct calls to Redis from workflows are not allowed as they are not deterministic and break other assumptions about workflow code.

---

<div class="post-metadata">

**Author:** ![Santa\_Claus\_2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/santa_claus_2/32/6763_2.png) [@Santa\_Claus\_2](https://community.temporal.io/u/Santa_Claus_2)\
**Post date:** [August 22, 2025, 7:00pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/3 "2025-08-22T19:00:45Z")

</div>

Thanks for the response! I understand the determinism concerns, but I’m facing a catch-22:

- Can’t use regular activities because I need the lock BEFORE spawning the activity (to control concurrency)

- Don’t want separate lock activities because that would double the activity count and add complexity

- Local activities still count toward activity limits and add overhead

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 22, 2025, 7:03pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/4 "2025-08-22T19:03:27Z")

</div>

Have you considered controlling the number of parallel activities by controlling the number of workers and limiting the parallelism per worker?

---

<div class="post-metadata">

**Author:** ![Santa\_Claus\_2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/santa_claus_2/32/6763_2.png) [@Santa\_Claus\_2](https://community.temporal.io/u/Santa_Claus_2)\
**Post date:** [August 22, 2025, 7:16pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/5 "2025-08-22T19:16:38Z")

</div>

The challenge is more granular: I need to limit specific activity types (not all activities) across multiple worker instances within a tenant.

Scenario:

- Multiple activity types per tenant

- Only certain activities need concurrency limits (e.g., resource-intensive ones)

- Other activities should run without limits

- Multiple worker instances per tenant

Worker-level limits don’t work because max\_concurrent\_activities applies to all activity types, but I need per-activity-type limits.

---

<div class="post-metadata">

**Author:** ![Santa\_Claus\_2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/santa_claus_2/32/6763_2.png) [@Santa\_Claus\_2](https://community.temporal.io/u/Santa_Claus_2)\
**Post date:** [August 24, 2025, 6:22am UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/6 "2025-08-24T06:22:08Z")

</div>

hello, any update on this?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 25, 2025, 12:35am UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/7 "2025-08-25T00:35:07Z")

</div>

Using a separate activity to acquire the lock is the way to go. Another option is to have a single task queue and then use a completely separate system like Redis to implement your rate limiting requirements.

---

<div class="post-metadata">

**Author:** ![Santa\_Claus\_2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/santa_claus_2/32/6763_2.png) [@Santa\_Claus\_2](https://community.temporal.io/u/Santa_Claus_2)\
**Post date:** [August 25, 2025, 3:38am UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/8 "2025-08-25T03:38:28Z")

</div>

I have an existing external Redis rate limiting system that I need to integrate. Is there a way to bypass deadlock detection for specific code blocks or increase the deadlock timeout without enabling full debug mode?

Context: I understand the determinism concerns, but I have a working Redis-based rate limiter that just needs a bit more time (3-5 seconds) for lock acquisition. Debug mode seems overkill and has performance implications.

Options I’m looking for:

1. Selective deadlock bypass for specific operations

2. Configurable deadlock timeout (per-workflow or globally)

3. Any other workarounds that don’t require debug mode

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 25, 2025, 5:57pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/9 "2025-08-25T17:57:45Z")

</div>

Does your system guarantee that the lock is obtained within seconds?  
What happens when the downstream system is down for a while and a large backlog accumulated?

---

<div class="post-metadata">

**Author:** ![Santa\_Claus\_2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/santa_claus_2/32/6763_2.png) [@Santa\_Claus\_2](https://community.temporal.io/u/Santa_Claus_2)\
**Post date:** [September 17, 2025, 7:30am UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/10 "2025-09-17T07:30:23Z")

</div>

what is the ideal duration of execution of a local\_activity, because the lock activity would be waiting for a very long time until the main activity gets over, any thoughts?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [September 17, 2025, 3:40pm UTC](https://community.temporal.io/t/is-there-a-way-to-increase-the-workflow-deadlock-detection-timeout-from-the-default-2-seconds-in-python-sdk/18256/11 "2025-09-17T15:40:44Z")

</div>

Don’t use local activity for “waiting a very long time”.
