This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/3.0 by this push:
new d9242195a fix: deadlock caused by rwMutex in limiter mapper (#2053)
d9242195a is described below
commit d9242195a5d894f02969d245dfd049d1fed4d9a8
Author: Yepeng Zhang <[email protected]>
AuthorDate: Fri Sep 16 09:27:08 2022 +0800
fix: deadlock caused by rwMutex in limiter mapper (#2053)
---
filter/adaptivesvc/limiter_mapper.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/filter/adaptivesvc/limiter_mapper.go
b/filter/adaptivesvc/limiter_mapper.go
index f4c2aac6a..e9343ed6e 100644
--- a/filter/adaptivesvc/limiter_mapper.go
+++ b/filter/adaptivesvc/limiter_mapper.go
@@ -58,6 +58,8 @@ func (m *limiterMapper) newAndSetMethodLimiter(url
*common.URL, methodName strin
ok bool
)
m.rwMutex.Lock()
+ defer m.rwMutex.Unlock()
+
if l, ok = limiterMapperSingleton.mapper[key]; ok {
return l, nil
}
@@ -68,7 +70,6 @@ func (m *limiterMapper) newAndSetMethodLimiter(url
*common.URL, methodName strin
return nil, ErrLimiterTypeNotFound
}
limiterMapperSingleton.mapper[key] = l
- m.rwMutex.Unlock()
return l, nil
}