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 in MediaGateway #1587

Open maria-farooq opened 7 years ago

maria-farooq commented 7 years ago

Here is the line where we get NPE: https://github.com/RestComm/Restcomm-Connect/blob/master/restcomm/restcomm.mgcp/src/main/java/org/restcomm/connect/mgcp/MediaGateway.java#L214

16:01:28,924 DEBUG [org.restcomm.connect.telscale.mrb.ConferenceMediaResourceController] (RestComm-akka.actor.default-dispatcher-45) got MRB response in conference resource controller
16:01:28,924 DEBUG [org.restcomm.connect.telscale.mrb.ConferenceMediaResourceController] (RestComm-akka.actor.default-dispatcher-45) masterMediaGateway acquired: Actor[akka://RestComm/user/$u]
16:01:28,924 ERROR [org.restcomm.connect.mgcp.MediaGateway] (RestComm-akka.actor.default-dispatcher-45) null: java.lang.NullPointerException
    at org.restcomm.connect.mgcp.MediaGateway.getSession(MediaGateway.java:214) [restcomm-connect.mgcp-8.0.0.1076.jar:8.0.0.1076]
    at org.restcomm.connect.mgcp.MediaGateway.onReceive(MediaGateway.java:315) [restcomm-connect.mgcp-8.0.0.1076.jar:8.0.0.1076]
    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:]
    at akka.actor.ActorCell.invoke(ActorCell.scala:386) [akka-actor_2.10-2.1.2.jar:]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) [akka-actor_2.10-2.1.2.jar:]
    at akka.dispatch.Mailbox.run(Mailbox.scala:212) [akka-actor_2.10-2.1.2.jar:]
    at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.2.jar:]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) [scala-library-2.10.1.jar:]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [scala-library-2.10.1.jar:]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) [scala-library-2.10.1.jar:]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [scala-library-2.10.1.jar:]
16

We got this exception in past as well but that was due to #1472 But we don’t see any error/exception related to mgcp stack this time.

link to logs: https://app.box.com/files/0/f/12027123541/9-Nove-2016

feedback from @hrosa : first step is to understand how that variable is set to null. Add some null-check and logging statement to track the state of that object.

also related to : #1471 and #1473

maria-farooq commented 7 years ago

quoting: @deruelle

let's also try to implement the lifecycle methods of the actor http://doc.akka.io/api/akka/2.1.2/index.html#akka.actor.UntypedActor so we can get more insights on what's going on and see if the actor dies somehow

maria-farooq commented 7 years ago

https://github.com/RestComm/Restcomm-Connect/commit/565091ebb60fdc7935c87424c4d25a1535d0cb83