jenrryyou opened a new pull request, #3216:
URL: https://github.com/apache/brpc/pull/3216
### What problem does this PR solve?
Issue Number: resolve
Problem Summary:
在 SocketMap 里决定“是否进入 defer_close 倒计时”时,不再无条件
defer,而是先看该连接最近一次读/写的活跃时间。
• 具体改动:当 ref_count 归零准备移除连接时,只有在“连接最近仍有活跃(last_active_time_us 距今不超过
defer_close_second)”的情况下,才把 no_ref_us
置为当前时间、开始倒计时;如果连接其实已经闲置超过 defer_close_second,则直接从 socket_map 删除并释放 socket
引用(src/brpc/socket_map.cpp:293)。
• 意图:避免老 socket 在“channel 频繁创建/析构导致 ref_count
归零又很快被重新引用”的场景下反复刷新倒计时,从而把一个已经长期不活跃/可能已失败的连接在
socket_map 里拖很久,导致新连接迟迟不创建、请求持续复用老连接并依赖其健康检查重连(进而在重连慢时持续失败)。
### What is changed and the side effects?
Changed:
Side effects:
- Performance effects:
- Breaking backward compatibility:
---
### Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]