prevent indefinite defer-close by checking last_active_time#3216
Open
jenrryyou wants to merge 1 commit intoapache:masterfrom
Open
prevent indefinite defer-close by checking last_active_time#3216jenrryyou wants to merge 1 commit intoapache:masterfrom
jenrryyou wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
You have changed the default behavior of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: