-
Notifications
You must be signed in to change notification settings - Fork 215
UserAgentManager actor restarts on NPE after ApplicationSession invalidate() #1764
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
Comments
@gvagenas @maria-farooq Should this be closed ? |
@deruelle can you shed some light for SipApplicationSession invalidation? Line 574 in 92a5810
|
@jaimecasero is responsible for anything related to SIP Servlets. My guess is that akka threading makes it so that the SipApplicationSession concurrency is not respected anymore as business logic runs in an akka thread and not in a container thread... |
in this case the appsession seems to be invalidated already (java.lang.IllegalStateException: SipApplicationSession already invalidated !). whether the app invalidated the session previously, or the container invalidated the session, I cant check on this short log... |
@jaimecasero if you check the link I provided in the comment earlier ( Line 574 in 92a5810
So looks like a race condition. |
as Jean mentioned, container Threads maybe racing with Akka Threads. We need to elaborate on how to sync Akka Threads and SipServlets threads. For me there are two possible options:
Again,first approach will require less app changes, but it may raise its own issues. Second approach may invovle lots of changes tin Restcomm actors, but it will definately work, since AsyncMode will invoke the SIPServlets concurrency mode... thoughts? |
@jaimecasero we can have actors to hold the app session id, this is not a problem. |
I know it sounds tedious to go through this 2 approch just to invalidate a session. We need to notice Akka and SipServlets are compeltely different eventDriven frameworks, and this requires careful cooperation. Can you imagine a SipServlets method invoking AkkaActor logic without going through the proper Akka MessageDispather, it would be a mess,right?. Even something as simple as closing an Akka Actor,requires the Akka framework to be managing that activity,right? same with SIPServlets. The fact the SIPServlects API is available anywhere in your application through the classloaders, doesnt mean it will work without proper management. Notice in JEE world the application is not meant to create its own ThreadPool, becuase those are not managed by container, so behavior will always be unpredictable under this nonStandard deployment... This is the class you need to use https://mobicents.ci.cloudbees.com/job/RestcommSipServlets-Release/lastSuccessfulBuild/artifact/documentation/jsr289-extensions-apidocs/org/mobicents/javax/servlet/sip/SipSessionAsynchronousWork.html to create an Async task. And this the one to execute it https://mobicents.ci.cloudbees.com/job/RestcommSipServlets-Release/lastSuccessfulBuild/artifact/documentation/jsr289-extensions-apidocs/org/mobicents/javax/servlet/sip/SipSessionsUtilExt.html#scheduleAsynchronousWork(java.lang.String,%20org.mobicents.javax.servlet.sip.SipApplicationSessionAsynchronousWork) Example of full usage at https://github.com/RestComm/sip-servlets/blob/master/sip-servlets-test-suite/applications/click-to-call-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/SimpleWebServlet.java#L182 |
Thanks @jaimecasero , I think I will create a utility class or actor that will take care all the SipServlets operations. Other actors will dispatch SipServlet tasks to this new actor so the changes in FSM will be less. |
sure, if you manage to create a simple wrapper to inject that logic it will be easier. Not sure how the SipServletsAPI invocation is merged in the regular RestcommActor logic. So, results from current invocations to SipServlets API may require additional work to be sent again to Akka,through proper Event passing... If you decide to go this way, and since you will need to review all SIPServlets invocation stuff, it might be good chance to take into consideration the new feature we are about to introduce in SIPServlets. The nonBlocking connect. This will be a major enhancement for Restcomm in terms of performance, and specially interesting in a Cluod environment to reduce blockign threads on network connect attempts. The basic change for you is that anytime you call message.send, instead of receiving a sync IOException in the same thread, you will receive a 503 response (in case of requests) later. It is up to you if you like to consider this now,or later, but probably @deruelle will require this as part of Restcomm sooner or later. Maybe you can just consider and make assumptions on what will be required, so when sipservlets is ready, you can perform the actual changes... Regards |
Closed by #2023 |
The text was updated successfully, but these errors were encountered: