RestComm / Restcomm-Connect

The Open Source Cloud Communications Platform
http://www.restcomm.com/
GNU Affero General Public License v3.0
242 stars 215 forks source link

NPE on P2P Calls if registration is not there #1517

Open deruelle opened 7 years ago

deruelle commented 7 years ago

During a P2P Call where a node was removed and some registrations lost we got

13:57:00,194 ERROR [org.restcomm.connect.telephony.CallManager] (RestComm-akka.actor.default-dispatcher-68) null: java.lang.NullPointerException RestCommException
at org.restcomm.connect.telephony.api.util.B2BUAHelper.redirectToB2BUA(B2BUAHelper.java:110) [restcomm-connect.telephony.api-8.0.0.16.jar:8.0.0.16]
at org.restcomm.connect.telephony.CallManager.invite(CallManager.java:370) [restcomm-connect.telephony-8.0.0.16.jar:8.0.0.16]
at org.restcomm.connect.telephony.CallManager.onReceive(CallManager.java:785) [restcomm-connect.telephony-8.0.0.16.jar:8.0.0.16]
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159) [akka-actor_2.10-2.1.2.jar:]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) [akka-actor_2.10-2.1.2.jar:]

We shouldn't bomb with NPE but rather handle this gracefully and send back a correct Error response to the caller.

deruelle commented 7 years ago

gvagenas [3:06 PM]
@jean.deruelle something is wrong with the client registration, the B2BUAHelper.redirectToB2BUA(B2BUAHelper.java:110) is the following:https://github.com/RestComm/Restcomm-Connect/blob/066df75f7ae7295e5124b3a8851b25be46653815/restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/B2BUAHelper.java#L110-L110 GitHub RestComm/Restcomm-Connect Restcomm-Connect - The Open Source Cloud Communications Platform

[3:08]
@jean.deruelle do you see this log message: if (logger.isInfoEnabled()) { logger.info("B2BUA (p2p proxy): Got request:\n" + request.getMethod()); logger.info(String.format("B2BUA: Proxying a session between %s and %s", client.getLogin(), toClient.getLogin())); } ?

lefty [3:13 PM]
13:53:25,163 INFO org.restcomm.connect.telephony.api.util.B2BUAHelper B2BUA: Proxying a session between 33679364376 and jcasero

jean.deruelle [3:13 PM]
@gvagenas I think it was during a test of @lefty at the same time

[3:13]
where he removed one node

[3:13]
but yes

[3:13]
13:57:00,173 INFO org.restcomm.connect.telephony.api.util.B2BUAHelper B2BUA: Proxying a session between 33679364376 and jcasero 13:57:00,173 DEBUG org.mobicents.servlet.sip.address.RFC2396UrlDecoder uri to decode jcasero

[3:14]
but I think we shouldn't bomb with NPE

[3:14]
and rather send back a message like destination not available

[3:14]
404

[3:14]
or something

gvagenas [3:14 PM]
Seems that something was wrong at the DB at this moment and the registration was not there.

jean.deruelle [3:16 PM]
this could be a common use case of the DB not having the user

[3:16]
can we protect against it ?

[3:16]
and send back an error message and not bomb with NPE ?