API requests intermittently fail with 502/500/504 errors after 10-20 requests #14571

Closed
opened 2026-02-21 19:17:51 -05:00 by yindo · 1 comment
Owner

Originally created by @outaiu2257 on GitHub (Jun 12, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.4.2

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Send API requests to Dify workflow via API
  2. Execute 10-20 consecutive API requests
  3. Observe intermittent errors occurring as described below

✔️ Expected Behavior

  • All API requests should be processed successfully
  • No errors should occur and responses should be returned normally
  • Processing speed should remain consistent

Actual Behavior

After 10-20 API requests, the following issues occur intermittently:

Error Types:

  • 502 Bad Gateway - Occurs occasionally, succeeds when retrying with same parameters
  • 500 Internal Server Error - Occurs occasionally, succeeds when retrying with same parameters
  • 504 Gateway Timeout - Occurs rarely, sometimes no request record appears in workflow logs (not reproducible)

Additional Symptoms:

  • Overall API processing speed appears to have become slower than before
  • When errors occur, retrying with the same parameters usually succeeds
  • Issues seem to manifest after a certain number of consecutive requests (10-20)
Originally created by @outaiu2257 on GitHub (Jun 12, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.4.2 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1. Send API requests to Dify workflow via API 2. Execute 10-20 consecutive API requests 3. Observe intermittent errors occurring as described below ### ✔️ Expected Behavior - All API requests should be processed successfully - No errors should occur and responses should be returned normally - Processing speed should remain consistent ### ❌ Actual Behavior After 10-20 API requests, the following issues occur intermittently: **Error Types:** - `502 Bad Gateway` - Occurs occasionally, succeeds when retrying with same parameters - `500 Internal Server Error` - Occurs occasionally, succeeds when retrying with same parameters - `504 Gateway Timeout` - Occurs rarely, sometimes no request record appears in workflow logs (not reproducible) **Additional Symptoms:** - Overall API processing speed appears to have become slower than before - When errors occur, retrying with the same parameters usually succeeds - Issues seem to manifest after a certain number of consecutive requests (10-20)
yindo added the stale label 2026-02-21 19:17:51 -05:00
yindo closed this issue 2026-02-21 19:17:51 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 12, 2025):

Hi @outaiu2257! I'm Dosu and I’m helping the dify team.

Your issue is likely related to rate limiting or resource constraints in the Dify cloud environment. Similar cases have been reported where hitting the platform's rate limit caused intermittent 502, 500, and 504 errors after a burst of requests, and maintainers confirmed this as a platform-side limitation for cloud users (source). The codebase enforces a maximum number of concurrent requests per client, and exceeding this can trigger errors or slowdowns (source).

Timeouts and server overload can also contribute, especially if requests are long-running or the system is under heavy load (source). Retrying usually works because the load temporarily drops below the threshold.

If you consistently need higher throughput, you may want to check if your plan or environment allows for increased concurrency or if there are options to optimize your workflow to reduce request duration. If the problem persists even at low request rates, it could indicate a temporary backend issue or a need for platform-side scaling.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jun 12, 2025): <!-- Greeting --> Hi @outaiu2257! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> Your issue is likely related to rate limiting or resource constraints in the Dify cloud environment. Similar cases have been reported where hitting the platform's rate limit caused intermittent 502, 500, and 504 errors after a burst of requests, and maintainers confirmed this as a platform-side limitation for cloud users [(source)](https://github.com/langgenius/dify/issues/19338). The codebase enforces a maximum number of concurrent requests per client, and exceeding this can trigger errors or slowdowns [(source)](https://github.com/langgenius/dify/blob/af83120832224f87e087c8152b66fa44077e1c3c/api/core/app/features/rate_limiting/rate_limit.py). Timeouts and server overload can also contribute, especially if requests are long-running or the system is under heavy load [(source)](https://github.com/langgenius/dify/issues/19009). Retrying usually works because the load temporarily drops below the threshold. If you consistently need higher throughput, you may want to check if your plan or environment allows for increased concurrency or if there are options to optimize your workflow to reduce request duration. If the problem persists even at low request rates, it could indicate a temporary backend issue or a need for platform-side scaling. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8789db27-05e8-4f73-af0f-2f8e8e473c35?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/20936)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14571