-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix:deal the panic when invoker destroy #358
Changes from 1 commit
0713fc1
6da0921
c250592
7f6fd6a
0ee1cd4
167d221
873c7d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ var ( | |
|
||
// DubboInvoker ... | ||
type DubboInvoker struct { | ||
sync.RWMutex | ||
pantianying marked this conversation as resolved.
Show resolved
Hide resolved
|
||
protocol.BaseInvoker | ||
client *Client | ||
quitOnce sync.Once | ||
|
@@ -62,6 +63,8 @@ func NewDubboInvoker(url common.URL, client *Client) *DubboInvoker { | |
|
||
// Invoke ... | ||
func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { | ||
di.RLock() | ||
pantianying marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defer di.RUnlock() | ||
var ( | ||
err error | ||
result protocol.RPCResult | ||
|
@@ -109,11 +112,15 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocati | |
|
||
// Destroy ... | ||
func (di *DubboInvoker) Destroy() { | ||
di.Lock() | ||
pantianying marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defer di.Unlock() | ||
|
||
di.quitOnce.Do(func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. someone check this pls: Can this be async There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the reqNum is used for judging if dubbo invoker is available ? Why not use isAvailable() func instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is used to check whether there are any stock requests in the invoker during destroy |
||
di.BaseInvoker.Destroy() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In extreme cases, infinite circulation possible? Should we control the upper limit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In extreme cases,there is always a request in the invoker that has not ended. If it is forcibly destroyed, it may cause a program panic. The severity of this result is greater than adding a loop. |
||
if di.client != nil { | ||
di.client.Close() | ||
di.client = nil | ||
} | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment for this file, pls.