-
Notifications
You must be signed in to change notification settings - Fork 36
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
begin
should let NSE unregister it self even if it doesn't have an event factory
#1529
Conversation
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1529 +/- ##
=======================================
Coverage ? 66.99%
=======================================
Files ? 259
Lines ? 12357
Branches ? 0
=======================================
Hits ? 8279
Misses ? 3557
Partials ? 521 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
Signed-off-by: Nikita Skrynnik <[email protected]>
q.Lock() | ||
_, err := next.NetworkServiceEndpointRegistryServer(ctx).Unregister(ctx, in) | ||
q.eventCount-- | ||
if q.eventCount == 0 { | ||
b.queueMap.Delete(id) | ||
} | ||
q.Unlock() | ||
return &emptypb.Empty{}, err |
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.
Is there a reason we hold the lock for the whole next.Unregister
call?
I would think that we only need it for q.eventCount
manipulations and b.queueMap.Delete
.
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.
Yes, there is a reason for this. Next chain elements can manipulate some data and if we have several concurrent Unregister events it can lead to data races. We need mutex for the whole Unregister call to let only one event go further.
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.
Oh, I have just noticed that you don't use event factory here.
But now I have a different question: what will happen if we get Register
call with the same ID as this Unregister call while Unregister is running under this mutex?
Fixed in another PR: #1542 |
Description
begin
should let NSE unregister it self even if it doesn't have an event factory. Also changeexpire
a bit to distinguish between events coming frombegin
and NSE.Issue link
networkservicemesh/sdk-k8s#456
How Has This Been Tested?
Types of changes