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
Read and Write lock for global config #39
Conversation
test container |
1 similar comment
test container |
retest container |
proto/server/configEvtHandler.go
Outdated
@@ -375,6 +380,8 @@ func getDeleteGroupsList(slice, prevSlice *configmodels.Slice) (names []string) | |||
} | |||
func Config5GUpdateHandle(confChan chan *Update5GSubscriberMsg) { | |||
for confData := range confChan { | |||
rwLock.RLock() | |||
rwLock.RUnlock() |
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.
Why do we lock and Unlock immediately in next line ?
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.
typo mistake. As per your comments, used Locks and Unlocks wherever it is required
proto/server/configEvtHandler.go
Outdated
@@ -78,13 +80,17 @@ func configHandler(configMsgChan chan *configmodels.ConfigMessage, configReceive | |||
configLog.Infoln("Waiting for configuration event ") | |||
select { | |||
case configMsg := <-configMsgChan: | |||
rwLock.Lock() | |||
defer rwLock.Unlock() |
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.
defer will never get called. and every select loop we will try to Lock() ?
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.
Please call explitc rwLock.Unlock() instead of using defer
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.
done
var configUMsg Update5GSubscriberMsg | ||
configUMsg.Msg = configMsg | ||
subsUpdateChan <- &configUMsg | ||
if factory.WebUIConfig.Configuration.Mode5G == true { |
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 spend so much time identifying this problem. Look at my changes in #41. ... Webconsole was getting blocked. I am suspecting this is what happened in production network as well.
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.
mostly this would have happened in production network. sorry for inconvenience
… into dev-imsiData-lock
… into dev-imsiData-lock
eb493cc
to
b2c53d5
Compare
postConfigHss(client, nil) | ||
rwLock.RUnlock() |
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.
why lock only for hss ?
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.
imsiData used inside postConfigHss Hence i used Rlock here
No description provided.