[2.0] mail-plugin hangs (freezes) my app

89 views
Skip to first unread message

MG

unread,
Apr 6, 2012, 4:05:39 PM4/6/12
to play-fr...@googlegroups.com
Hi - I was wondering if anyone is able to use the mail-plugin in a production environment successfully?

I have included it in my app, but unable to get it working. For some reason, the plugin hangs when I call MailPlugin.send(m). My app never gets the control back so the entire app freezes at that point.

I looked at the mail-plugin source, but couldn't figure out the issue. Here are the source code for the send method:

   private def sendMessage(msg:Email)(implicit app:Application):Promise[Boolean] = {
      import akka.util.Timeout
      implicit val timeout = Timeout(Duration(5, "seconds"))
      (MailWorker.ref ? (msg)).mapTo[Boolean].asPromise //FIX-ME, switch to fire and forget
   }

There is a comment that says FIX-ME, but I have no clue how to fix it.

I would appreciate if you could tell me what may be the problem and how do I fix it?

It would also helpful to know if anyone is able to use the mail-plugin successfully in a production environment by just following the direction in the readme file.

Thanks,
MG

MG

unread,
Apr 6, 2012, 9:03:43 PM4/6/12
to play-fr...@googlegroups.com
I found out what was the problem; I made a rookie mistake. Looking at source code again, I realize that it is returning Promise, which I was ignoring in my code. I am still having some other problem, but at least now I know why the browser was becoming non-responsive.

MG

unread,
Apr 6, 2012, 10:05:41 PM4/6/12
to play-fr...@googlegroups.com
I am stuck again with the following exception. It is thrown five seconds after I call MailPlugin.send

2012-04-06 18:58:01,049 - [ERROR] - from play in application-akka.actor.default-dispatcher-3
Waiting for a promise, but got an error: null
akka.pattern.AskTimeoutException: null
    at akka.dispatch.DefaultPromise.result(Future.scala:839) [akka-actor.jar:2.0]
    at akka.dispatch.Await$.result(Future.scala:74) ~[akka-actor.jar:2.0]
    at play.api.libs.concurrent.AkkaPromise.await(Akka.scala:43) ~[play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.Promise$class.await(Promise.scala:44) ~[play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.AkkaPromise.await(Akka.scala:28) ~[play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.Promise$class.value(Promise.scala:42) ~[play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.AkkaPromise.value(Akka.scala:28) ~[play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.Promise$$anonfun$extend1$1.apply(Promise.scala:40) [play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.Promise$$anonfun$extend1$1.apply(Promise.scala:40) [play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.AkkaPromise$$anonfun$extend$2$$anonfun$apply$3.apply(Akka.scala:37) [play_2.9.1.jar:2.0]
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110) [scala-library.jar:na]
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110) [scala-library.jar:na]
    at scala.util.control.Exception$Catch.apply(Exception.scala:88) [scala-library.jar:na]
    at scala.util.control.Exception$Catch.either(Exception.scala:110) [scala-library.jar:na]
    at play.api.libs.concurrent.STMPromise.redeem(Promise.scala:166) [play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.AkkaPromise$$anonfun$extend$2.apply(Akka.scala:37) [play_2.9.1.jar:2.0]
    at play.api.libs.concurrent.AkkaPromise$$anonfun$extend$2.apply(Akka.scala:37) [play_2.9.1.jar:2.0]
    at akka.dispatch.Future$$anonfun$onFailure$1.apply(Future.scala:480) [akka-actor.jar:2.0]
    at akka.dispatch.Future$$anonfun$onFailure$1.apply(Future.scala:479) [akka-actor.jar:2.0]
    at akka.dispatch.DefaultPromise.akka$dispatch$DefaultPromise$$notifyCompleted(Future.scala:907) [akka-actor.jar:2.0]
    at akka.dispatch.DefaultPromise$$anonfun$tryComplete$1$$anonfun$apply$mcV$sp$4.apply(Future.scala:884) [akka-actor.jar:2.0]
    at akka.dispatch.DefaultPromise$$anonfun$tryComplete$1$$anonfun$apply$mcV$sp$4.apply(Future.scala:884) [akka-actor.jar:2.0]
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) [scala-library.jar:0.11.2]
    at scala.collection.immutable.List.foreach(List.scala:45) [scala-library.jar:0.11.2]
    at akka.dispatch.DefaultPromise$$anonfun$tryComplete$1.apply$mcV$sp(Future.scala:884) [akka-actor.jar:2.0]
    at akka.dispatch.Future$$anon$4$$anonfun$run$1.apply$mcV$sp(Future.scala:386) [akka-actor.jar:2.0]
    at akka.dispatch.Future$$anon$4$$anonfun$run$1.apply(Future.scala:378) [akka-actor.jar:2.0]
    at akka.dispatch.Future$$anon$4$$anonfun$run$1.apply(Future.scala:378) [akka-actor.jar:2.0]
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57) [scala-library.jar:na]
    at akka.dispatch.Future$$anon$4.run(Future.scala:378) [akka-actor.jar:2.0]
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:83) [akka-actor.jar:2.0]
    at akka.jsr166y.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1381) [akka-actor.jar:2.0]
    at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) [akka-actor.jar:2.0]
    at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:997) [akka-actor.jar:2.0]
    at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1495) [akka-actor.jar:2.0]
    at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [akka-actor.jar:2.0]

2012-04-06 18:58:16,322 - [ERROR] - from application in application-akka.actor.default-dispatcher-5
MailPlugin error:Generic error: Exception reading response

Any idea what could be causing this exception?

MG

unread,
Apr 9, 2012, 11:21:07 AM4/9/12
to play-fr...@googlegroups.com
Problem solved by switching to a different SMTP server. At some point I need to figure out why the MailPlugin would not work with AT&T's SMTP server, but for now I can continue with my app.
Reply all
Reply to author
Forward
0 new messages