Skip to content

clearAttachments in ConsumerContextFilter may lead to something wrong for cluster #1978

Closed

Description

@liulijun553

dubbo provided many cluster for example: failover,failfast,failsafe,failback,forking,mergeable,broadcast.
in FailoverClusterInvoker,dubbo will try another provider when catch RpcException.
in BroadcastClusterInvoker,dubbo will call all providers one by one.
in FailbackClusterInvoker , dubbo will retry when failed.
in ForkingClusterInvoker, dubbo will call all providers in different thread.
but ConsumerContextFilter will clearAttachments after call. it's lead to Attachments lost when retry and Muti call in clusterInvoker.

dubbo提供了很多不同类型的cluster,例如failover,failfast,failsafe,failback,forking,mergeable,broadcast.
其中FailoverClusterInvoker会做失败转移,调用失败后重试另一台服务器。
BroadcastClusterInvoker会依次调用所有的服务器。
FailbackClusterInvoker中,如果调用失败,会定时重试。
ForkingClusterInvoker中,会在不同的线程中分别调用所有的服务提供方。
但是,dubbo中同时还存在一个filter叫做ConsumerContextFilter,在一次调用完成后会立即清理掉所有的Attachments。所以,不管是FailoverClusterInvoker的失败转移,还是FailbackClusterInvoker的定时重试,抑或是BroadcastClusterInvoker的广播,都会存在问题,因为后续的调用中,Attachments已经全部丢失了。

一次调用完成后,的确应该清理Attachments,但Attachments的清理时机放在ConsumerContextFilter是不合适的,不管是FailoverClusterInvoker的失败转移,还是FailbackClusterInvoker的定时重试,在重试调用的时候,参数和第一次调用时应该是完全一致的,而非失败重试时参数丢失,Attachments清理最正确的做法应该是在cluster级别来做。

Activity

  1. kimmking commented on Jul 7, 2018

    @kimmking
    Member

    @liulijun553
    This issue will be fixed sooner by @carryxyh.

  2. added a commit that references this issue on Jul 31, 2018
    0278a01
  3. added a commit that references this issue on Aug 2, 2018
    1376b26
  4. added a commit that references this issue on Sep 10, 2019
    116c9c3
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions