Skip to content

[Bug]:单例并发问题,目前多用户同时问,总会出现等待 #2256

Open

Description

@cainiaow1

AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. You code
  2. How to execute
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Error messages
Detailed error messages.

Environment (please complete the following information):

  • AgentScope-Java Version: [e.g. 1.0.12, check your pom.xml dependency version or run mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]
  • Java Version: [e.g. 17]
  • OS: [e.g. macos, windows]

Additional context
Add any other context about the problem here.

Activity

  1. added
    bug
    on Jul 16, 2026
  2. added
    area/core
    on Jul 17, 2026
  3. tanzzj commented on Jul 17, 2026

    @tanzzj
    Collaborator

    1.x版本下的最佳实践是一个对话build一个agent实例出来,而不是复用同一个实例。2.x版本下HarnessAgent支持单例并发。但是如果单例下同一个sessionid发起了多个会话,也会出现agent is still runing

  4. cainiaow1 commented on Jul 17, 2026

    @cainiaow1
    Author

    1.x版本下的最佳实践是一个对话build一个agent实例出来,而不是复用同一个实例。2.x版本下HarnessAgent支持单例并发。但是如果单例下同一个sessionid发起了多个会话,也会出现agent is still runing

    这里不是同一个sessionId发起的多个会话,是多个useId并发提问

  5. tanzzj commented on Jul 18, 2026

    @tanzzj
    Collaborator

    1.x版本下的最佳实践是一个对话build一个agent实例出来,而不是复用同一个实例。2.x版本下HarnessAgent支持单例并发。但是如果单例下同一个sessionid发起了多个会话,也会出现agent is still runing

    这里不是同一个sessionId发起的多个会话,是多个useId并发提问

    按照AS Java的设计,如果你是1.x版本则每次chat都重新build一个新的Agent实例出来即可。如果你是2.x版本的话,用HarnessAgent单例是没问题的

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

    area/corebug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions