-
Notifications
You must be signed in to change notification settings - Fork 41
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
Possible concurrency issue - events not being executed sequentially. #13
Comments
hey @csiwek Good to hear from you (in one way happy you have issues ;) ). Will make the possibility to have it synchronous there and close this issue when done. DanB |
thanks Dan, |
@csiwek, yes it did happened to us as well (eg: HANGUP before CHANNEL_CREATE) but we did not bother blocking there since I am not 100% FS sends them in order (although there are chances it does). DanB |
hi @csiwek Looking at the issues, I see this one still being opened. Did u work-around it? As said I cannot testify that FS sends events in order. DanB |
Hi @danbogos For now, we have ended up by not executing the handlerFunc as a new goroutine (which I mentioned in the first post) and doing it when necessary inside those functions . This definitely fixes issues we were having so I guess FS is trying to keep events in the right order. I understand you probably will never experience this issue because the way you are using FS. Our application behaviour highly relies on the actual call state |
Thanks for the update. Please reopen if you think changes are needed. Have a good one and see you most probably at ClueCon! DanB |
Hi Dan,
This is the part which I'm going to challenge :-)
for _, handlerFunc := range self.eventHandlers[handleName] { go handlerFunc(event, self.connId) }
We've just had an issue when events are not being processed sequentially.
I's probably regarding to every handlerFunc being executed as a separate goroutine. From the library point of view, it makes perfectly sense. You can't block here - you want to process next event as soon as possible. Things get complicated when you need different time period to process events.
In out case we have spotted that library executes conference:del-member was fired before add-member.
When you want to build some kind of state machine it gets very messy.
What we did, we removed 'go' from the library but we are executing code as goroutine inside the handler function. If we require some events to be processed sequentially we can still do it.
What do you think? Did you have this issue in cgrates? can you afford to call every handler as goroutine?
greetings from Nexmo :-)
Cezary
The text was updated successfully, but these errors were encountered: