Hi. I have comet actor named ProcessingMonitor on a page. Sometimes I observe freezing between rerender completion and changes being applied on the client.
Here is how looks my render method:
def render = {
val cssSel = "#id" #> ... & "#id2" #> ... & ...
(in: NodeSeq) => {
val start = System.currentTimeMillis()
val nodeSeq = cssSel(in)
val time = System.currentTimeMillis() - start
logger.debug(s"Rendering took ${time}ms")
nodeSeq
}
}
And when I click on a button reRender is invoked and I see that rendering took only 218ms. But the changes are applied after 50 seconds(!). This is what I see in logs:
CASE 1(several ajax requests:
2013-08-22 10:00:12,804 [pool-11-thread-4] DEBUG com.*.ProcessingMonitor - reRender()
2013-08-22 10:00:12,805 [qtp1877710376-54 - /ajax_request/F1229511276243HNMVEM-10/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F1229511276243HNMVEM-10/ returned 200, took 8 Milliseconds
2013-08-22 10:00:13,027 [pool-11-thread-4] DEBUG com.db.itrac.dashboard.comet.ProcessingMonitor - Rendering took 218ms
> //------ here is freezing from 10:00:13 to 10:01:03 ------///
2013-08-22 10:01:03,756 [qtp1877710376-61 - /ajax_request/F1229511237802JK1MRN/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F1229511237802JK1MRN/ returned 200, took 6 Milliseconds
2013-08-22 10:01:17,763 [qtp1877710376-58 - /comet_request/64713511592/1n8lavbmy16o9crytazmxwnd/F1229511237802JK1MRN?F1229511237803J1DGLL=1229511246201&_=1377154877745] INFO net.liftweb.util.TimeHelpers - Service request (GET) /comet
_request/64713511592/1n8lavbmy16o9crytazmxwnd/F1229511237802JK1MRN returned 0, took 4 Milliseconds
2013-08-22 10:01:24,774 [qtp1877710376-59 - /ajax_request/F1229511276243HNMVEM/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F1229511276243HNMVEM/ returned 200, took 4 Milliseconds
2013-08-22 10:02:01,770 [qtp1877710376-60 - /ajax_request/F1229511237697IFYQ1U/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F1229511237697IFYQ1U/ returned 200, took 5 Milliseconds
2013-08-22 10:02:19,766 [qtp1877710376-60 - /ajax_request/F1229511237802JK1MRN/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F1229511237802JK1MRN/ returned 200, took 7 Milliseconds
2013-08-22 10:02:40,764 [qtp1877710376-61 - /ajax_request/F1229511276243HNMVEM/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F1229511276243HNMVEM/ returned 200, took 4 Milliseconds
// here we have several ajax requests
CASE 2:
2013-08-22 11:03:39,001 [pool-11-thread-12] DEBUG com.*.ProcessingMonitor - reRender()
2013-08-22 11:03:39,003 [qtp569197316-57 - /ajax_request/F615114249711I2PLNY-k0/] INFO net.liftweb.util.TimeHelpers - Service request (POST) /ajax_request/F615114249711I2PLNY-k0/ returned 200, took 9 Milliseconds
2013-08-22 11:03:39,169 [pool-11-thread-12] DEBUG com.db.itrac.dashboard.comet.ProcessingMonitor - Rendering took 165ms
> //------ here is freezing from 11:03:39 to 11:03:49 ------///
> 2013-08-22 11:03:49,252 [qtp569197316-59 - /comet_request/10142751131/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY?F615114247718YC5EGR=615114250545&_=1377158629195] INFO net.liftweb.util.TimeHelpers - Service request (GET) /comet_request/10142751131/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY returned 0, took 2 Milliseconds
2013-08-22 11:03:49,414 [qtp569197316-57 - /comet_request/38890918809/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY?F615114247718YC5EGR=615114250571&_=1377158629401] INFO net.liftweb.util.TimeHelpers - Service request (GET) /comet_request/38890918809/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY returned 0, took 2 Milliseconds
2013-08-22 11:03:49,542 [qtp569197316-61 - /comet_request/60421149292/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY?F615114247718YC5EGR=615114250624&_=1377158629526] INFO net.liftweb.util.TimeHelpers - Service request (GET) /comet_request/60421149292/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY returned 0, took 2 Milliseconds
2013-08-22 11:03:52,093 [qtp569197316-61 - /comet_request/36007535946/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY?F615114247718YC5EGR=615114250631&_=1377158632076] INFO net.liftweb.util.TimeHelpers - Service request (GET) /comet_request/36007535946/1rpulsafzvopczc22jzxyl932/F615114249711I2PLNY returned 0, took 4 Milliseconds
// here we have several comet requests
You can see that there is freeze from 10:00:13 to 10:01:03
after these ajax requests being processed I eventually see changes applied on the client
I would also emphasize that this issue happens in 20% cases.
Am I doing something wrong way ? Did anybody get the same issue ?
Sometimes I also see in logs weird exception, probably it can help somehow(but maybe it's not related to the issue):
2013-08-22 11:00:42,854 [pool-11-thread-8] ERROR net.liftweb.http.provider.servlet.containers.Servlet30AsyncProvider - Servlet 3.0 Async: Couldn't resume thread
java.lang.NullPointerException
at org.eclipse.jetty.http.HttpGenerator.prepareBuffers(HttpGenerator.java:974)
at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:934)
at org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:518)
at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:442)
at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:94)
at org.eclipse.jetty.server.AbstractHttpConnection$Output.flush(AbstractHttpConnection.java:1022)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:173)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:111)
at net.liftweb.http.LiftServlet.sendResponse(LiftServlet.scala:890)
at net.liftweb.http.provider.servlet.containers.Servlet30AsyncProvider.resume(Servlet30AsyncProvider.scala:114)
at net.liftweb.http.provider.servlet.HTTPRequestServlet.resume(HTTPRequestServlet.scala:163)
at net.liftweb.http.LiftServlet$$anonfun$17.apply(LiftServlet.scala:707)
at net.liftweb.http.LiftServlet$$anonfun$17.apply(LiftServlet.scala:706)
at net.liftweb.http.LiftServlet$ContinuationActor$$anonfun$messageHandler$1.applyOrElse(LiftServlet.scala:692)
at scala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
at scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
at scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
at net.liftweb.actor.LiftActor$class.execTranslate(LiftActor.scala:440)
at net.liftweb.http.LiftServlet$ContinuationActor.execTranslate(LiftServlet.scala:667)
at net.liftweb.actor.SpecializedLiftActor$class.liftedTree2$1(LiftActor.scala:288)
at net.liftweb.actor.SpecializedLiftActor$
class.net$liftweb$actor$SpecializedLiftActor$$proc2(LiftActor.scala:287)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply$mcV$sp(LiftActor.scala:210)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:210)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:210)
at net.liftweb.actor.SpecializedLiftActor$class.around(LiftActor.scala:224)
at net.liftweb.http.LiftServlet$ContinuationActor.around(LiftServlet.scala:667)
at net.liftweb.actor.SpecializedLiftActor$
class.net$liftweb$actor$SpecializedLiftActor$$processMailbox(LiftActor.scala:209)
at net.liftweb.actor.SpecializedLiftActor$$anonfun$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(LiftActor.scala:173)
at net.liftweb.actor.LAScheduler$$anonfun$9$$anon$2$$anon$3.run(LiftActor.scala:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)