Skip to content

XIDLoadBalance fails to match when SEATA_IP is a domain name #8158

Description

@chao6118

Check Ahead

  • I have searched the issues of this repository and believe that this is not a duplicate.

  • I am willing to try to fix this bug myself.

Ⅰ. Issue Description

SEATA_IP=seata.aaa.com 时,XID 生成的是域名前缀 seata.aaa.com:8092:12345。
XIDLoadBalance.select() 用 InetSocketAddress.equals() 比较 XID 的域名和通道池里解析后的 IP,
域名 vs IP 永远不匹配。

每次分支事务注册都走 fallback 随机负载均衡,高并发下有性能开销。

Root Cause:
XID.java:55-62 直接拼接 SEATA_IP,不做解析
InetSocketAddress 带域名创建时是 unresolved,equals() 不解析只比字符串

建议:
在 XIDLoadBalance.select() 中先判断 isUnresolved(),如果 true 解析成 IP 再比
或者文档明确要求 SEATA_IP 必须填 IP

Ⅱ. Describe what happened

SEATA_IP=seata.aaa.com 时,XID 生成的是域名前缀 seata.aaa.com:8092:12345。
XIDLoadBalance.select() 用 InetSocketAddress.equals() 比较 XID 的域名和通道池里解析后的 IP,
域名 vs IP 永远不匹配。

每次分支事务注册都走 fallback 随机负载均衡,高并发下有性能开销。

Root Cause:
XID.java:55-62 直接拼接 SEATA_IP,不做解析
InetSocketAddress 带域名创建时是 unresolved,equals() 不解析只比字符串

建议:
在 XIDLoadBalance.select() 中先判断 isUnresolved(),如果 true 解析成 IP 再比
或者文档明确要求 SEATA_IP 必须填 IP

Ⅲ. Describe what you expected to happen

No response

Ⅳ. How to reproduce it (as minimally and precisely as possible)

No response

Ⅴ. Anything else we need to know?

No response

Ⅵ. Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions