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.
Motivation:
对 Bolt 的 InvokeContext 上有误解(以为 bolt 内部只读不写,用户层写),实际上 bolt 内部也会写 ctx 来传递上下文,比如一个 rpc 调用会先记录获取连接的时间 t 到 ctx 中,再计算 rpc 超时再从 ctx 中取出来,jraft 错误的使用了 InvokeCtx,在上层不传入 ctx 时会使用一个全局的 default instance,这导致了上面那个 t 并发写入覆盖的问题,在获取连接耗时较高(第一次建连)时,t 较大占用了 rpcTimeout 的大部分,导致 rpc 调用超时
https://github.com/sofastack/sofa-bolt/blame/master/src/main/java/com/alipay/remoting/InvokeContext.java
create_conn_time 计入 rpc_timeout 时间是在 1.6.4 引入的新特性,1.6.2 没问题
Modification:
Describe the idea and modifications you've done.
Result:
Fixes #810
If there is no issue then describe the changes introduced by this PR.