Skip to content

Streaming app requests are rejected when maximum concurrency is 1 #45037

Closed

Description

@hjlarry

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is a bug report.
  • I have searched for existing issues, including closed ones.
  • I am submitting this report in English.

Dify version

Development main at 4eef080524babe78d7dd2d14746ce6141ca5e526.

Cloud or Self Hosted

Cloud (test environment).

Steps to reproduce

  1. Create a Workflow app with a Start node connected directly to an End node.
  2. Set the app's maximum concurrent requests to 1.
  3. Ensure there are no other active requests.
  4. Run the workflow once in the editor using the streaming execution path.

Expected Behavior

The first request is accepted. A second request is rejected while the first stream is active, and a new request can be accepted after that stream finishes or closes.

Actual Behavior

The only request is rejected before the workflow starts:

Too many requests. Please try again later. The current maximum concurrent requests allowed for <app_id> is 1.

AppGenerateService._run_with_guardrails already calls RateLimit.enter. The Workflow and Advanced Chat streaming branches call rate_limit_context again with the same request ID, so the first request counts against itself. With a larger limit, the inner context also releases the slot before the response stream has been consumed.

The outer guard and RateLimitGenerator already own admission and cleanup. Removing the duplicate contexts preserves that lifecycle. The now-unused context helper can then be removed.

Activity

  1. added
    🐞 bug
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions