Skip to content

使用随机节点标识替换基于 MAC 的 Redis 锁节点区分#13

Closed
onekb wants to merge 1 commit intohyperf:masterfrom
onekb:master
Closed

使用随机节点标识替换基于 MAC 的 Redis 锁节点区分#13
onekb wants to merge 1 commit intohyperf:masterfrom
onekb:master

Conversation

@onekb
Copy link
Contributor

@onekb onekb commented Oct 8, 2025

  • 修复多节点 Docker 环境下容器默认 MAC 前缀一致(例:02:42:ac:..)导致多容器 Redis 锁误判为同一节点的问题:原本的 swoole_get_local_mac() 返回的地址相同,使得节点互相抢锁却都认为自己持有锁(src/Mutex/RedisServerMutex.php:24, 86-139)
  • 改为在启动时生成随机节点标识并缓存于容器或进程,确保每个实例拥有独立身份;若外部注入了 ServerNodeInterface,仍优先使用其名称以支持自定义实现

@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Hi, this is a READ-ONLY repository, please submit your PR on the https://github.com/hyperf/hyperf repository.

This Pull Request will close automatically.

Thanks!

@github-actions github-actions bot closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant