NoSuchElementException in LiftSession:1012

20 views
Skip to first unread message

Andreas Joseph Krogh

unread,
Mar 13, 2015, 11:43:34 AM3/13/15
to lif...@googlegroups.com
Hi all.
 
From time to time I get this in my logs:
 
2015-03-13 16:00:46,731 ERROR [liftExecutor-1-thread-808] - [] []  ActorLogger                    - Actor threw an exception
java.util.NoSuchElementException: None.get
at scala.None.get(Option.scala:347)
at scala.None.get(Option.scala:345)
at net.liftweb.http.LiftSession.run1(LiftSession.scala:1012)
at net.liftweb.http.LiftSession.postPageJavaScript(LiftSession.scala:1024)
at net.liftweb.http.LiftSessionanonfunpostPageJavaScript1.apply(LiftSession.scala:1040)
at net.liftweb.http.LiftSessionanonfunpostPageJavaScript1.apply(LiftSession.scala:1039)
at scala.collection.immutable.List.flatMap(List.scala:327)
at net.liftweb.http.LiftSession.postPageJavaScript(LiftSession.scala:1039)
 
The offending code looks like this:
 
org match {
  case None => Nil
  case Some(ppf) => {
    val lb = new ListBuffer[JsCmd]

    def run(count: Int, funcs: List[() => JsCmd]) {
      funcs.reverse.foreach(f => lb += f())
      val next = org.get // safe to do get here because we know the
      // postPageFunc is defined
 
Is there any reason we dont use "ppf" from the extractor Some(ppf)?
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963

Diego Medina

unread,
Mar 13, 2015, 4:46:21 PM3/13/15
to Lift
I think it is safe to make the change and use
val next = ppf

Thanks




--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am

Antonio Salazar Cardozo

unread,
Mar 14, 2015, 4:25:07 PM3/14/15
to lif...@googlegroups.com
I'm not so sure it's safe. run and org are both defs, not vals. They're used to encapsulate
locked access to the post-page functions, which may change while the function is running;
thus this part of the run call:


// if the function table is updated, make sure to get
// the additional functions
if (diff == 0) {} else {
run(next.functionCount, next.functions.take(diff))
}

Who is invoking the post-page functions and triggering that exception? Is this happening from
comet or elsewhere?
Thanks,
Antonio
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Andreas Joseph Krogh

unread,
Mar 14, 2015, 11:35:18 PM3/14/15
to lif...@googlegroups.com
På lørdag 14. mars 2015 kl. 21:25:06, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
I'm not so sure it's safe. run and org are both defs, not vals. They're used to encapsulate
locked access to the post-page functions, which may change while the function is running;
thus this part of the run call:
 
 
  // if the function table is updated, make sure to get
  // the additional functions
  if (diff == 0) {} else {
  run(next.functionCount, next.functions.take(diff))
  }
 
Who is invoking the post-page functions and triggering that exception? Is this happening from
comet or elsewhere?
Thanks,
Antonio
 
The stack-trace suggests that it's from a comet-actor, it contains none of my app's classes.
 
The whole point is that it *does* change because it's a def, hence the NoSuchElementException; First it checks if the reesult of the def is Some, *then* it calls the def again - which might return None this time.

Antonio Salazar Cardozo

unread,
Mar 15, 2015, 2:22:03 PM3/15/15
to lif...@googlegroups.com
I definitely agree we need to tweak the implementation to avoid the issue, I'm
just trying to see where in the pipeline the expectations that are implicit in that
function were inaccurate.

I adjusted when post-page functions are looked up for comets when I fixed
if that triggered this behavior. Are you on 3.0-M3 or later? And if you are, was
this an app that worked without the issue before M3?
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Mar 15, 2015, 4:33:54 PM3/15/15
to lif...@googlegroups.com
På søndag 15. mars 2015 kl. 19:22:03, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
I definitely agree we need to tweak the implementation to avoid the issue, I'm
just trying to see where in the pipeline the expectations that are implicit in that
function were inaccurate.
 
I adjusted when post-page functions are looked up for comets when I fixed
if that triggered this behavior. Are you on 3.0-M3 or later? And if you are, was
this an app that worked without the issue before M3?
Thanks,
Antonio
 
This happens using 2.6

Antonio Salazar Cardozo

unread,
Mar 15, 2015, 5:55:24 PM3/15/15
to lif...@googlegroups.com
Interesting… And strange. Can you post the stack trace through the Lift CometActor
lines? I think I know where this is being triggered, but not 100% sure.
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Mar 15, 2015, 10:45:35 PM3/15/15
to lif...@googlegroups.com
På søndag 15. mars 2015 kl. 22:55:24, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
Interesting… And strange. Can you post the stack trace through the Lift CometActor
lines? I think I know where this is being triggered, but not 100% sure.
Thanks,
Antonio
 
Sure:
 
2015-03-13 09:14:14,390 ERROR [liftExecutor-1-thread-918] - [] []  ActorLogger                    - Actor threw an exception
java.util.NoSuchElementException: None.get
        at scala.None$.get(Option.scala:347)
        at scala.None$.get(Option.scala:345)
        at net.liftweb.http.LiftSession.run$1(LiftSession.scala:1012)
        at net.liftweb.http.LiftSession.postPageJavaScript(LiftSession.scala:1024)
        at net.liftweb.http.LiftSession$$anonfun$postPageJavaScript$1.apply(LiftSession.scala:1040)
        at net.liftweb.http.LiftSession$$anonfun$postPageJavaScript$1.apply(LiftSession.scala:1039)

        at scala.collection.immutable.List.flatMap(List.scala:327)
        at net.liftweb.http.LiftSession.postPageJavaScript(LiftSession.scala:1039)
        at net.liftweb.http.S$$anonfun$2.apply(S.scala:845)
        at net.liftweb.http.S$$anonfun$2.apply(S.scala:844)
        at net.liftweb.common.Full.map(Box.scala:610)
        at net.liftweb.http.S$class.jsToAppend(S.scala:844)
        at net.liftweb.http.S$.jsToAppend(S.scala:47)
        at net.liftweb.http.LiftServlet$$anonfun$21$$anonfun$apply$14$$anonfun$apply$15.apply(LiftServlet.scala:769)
        at net.liftweb.http.LiftServlet$$anonfun$21$$anonfun$apply$14$$anonfun$apply$15.apply(LiftServlet.scala:769)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$generateSnapshotRestorer$1$$anonfun$apply$8$$anonfun$apply$9$$anonfun$apply$10$$anonfun$apply$11.apply(Vars.scala:546)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$generateSnapshotRestorer$1$$anonfun$apply$8$$anonfun$apply$9$$anonfun$apply$10.apply(Vars.scala:545)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$generateSnapshotRestorer$1$$anonfun$apply$8$$anonfun$apply$9.apply(Vars.scala:544)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$generateSnapshotRestorer$1$$anonfun$apply$8.apply(Vars.scala:543)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$generateSnapshotRestorer$1.apply(Vars.scala:542)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$generateSnapshotRestorer$1.apply(Vars.scala:542)
        at net.liftweb.http.S$PageStateHolder.runInContext(S.scala:228)
        at net.liftweb.http.RenderVersion$$anonfun$15$$anonfun$apply$28$$anonfun$16.apply(LiftSession.scala:459)
        at net.liftweb.util.AnyVarTrait$class.doWith(AnyVar.scala:234)
        at net.liftweb.util.AnyVar.doWith(AnyVar.scala:89)
        at net.liftweb.http.RenderVersion$$anonfun$15$$anonfun$apply$28.apply(LiftSession.scala:458)
        at net.liftweb.http.RenderVersion$$anonfun$15$$anonfun$apply$28.apply(LiftSession.scala:454)
        at scala.Option.map(Option.scala:146)
        at net.liftweb.http.RenderVersion$$anonfun$15.apply(LiftSession.scala:454)
        at net.liftweb.http.RenderVersion$$anonfun$15.apply(LiftSession.scala:453)
        at net.liftweb.common.Full.flatMap(Box.scala:612)
        at net.liftweb.http.RenderVersion$.doWith(LiftSession.scala:453)
        at net.liftweb.http.LiftServlet$$anonfun$21$$anonfun$apply$14.apply(LiftServlet.scala:768)
        at net.liftweb.http.LiftServlet$$anonfun$21$$anonfun$apply$14.apply(LiftServlet.scala:767)
        at net.liftweb.common.Full.map(Box.scala:610)
        at net.liftweb.http.LiftServlet$$anonfun$21.apply(LiftServlet.scala:767)
        at net.liftweb.http.LiftServlet$$anonfun$21.apply(LiftServlet.scala:766)
        at net.liftweb.common.Full.flatMap(Box.scala:612)
        at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$$convertAnswersToCometResponse(LiftServlet.scala:766)
        at net.liftweb.http.LiftServlet$$anonfun$17$$anonfun$apply$12.apply(LiftServlet.scala:710)
        at net.liftweb.http.LiftServlet$$anonfun$17$$anonfun$apply$12.apply(LiftServlet.scala:709)
        at net.liftweb.http.S$class.net$liftweb$http$S$$wrapQuery(S.scala:1470)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1$$anonfun$apply$38.apply(S.scala:1635)
        at net.liftweb.http.S$class.net$liftweb$http$S$$doAround(S.scala:1399)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1.apply(S.scala:1633)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$class.net$liftweb$http$S$$_nest2InnerInit(S.scala:1632)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun$apply$42$$anonfun$apply$43$$anonfun$apply$44$$anonfun$apply$45.apply(S.scala:1678)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$withReq$2.apply(S.scala:1688)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$class.withReq(S.scala:1687)
        at net.liftweb.http.S$.withReq(S.scala:47)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun$apply$42$$anonfun$apply$43$$anonfun$apply$44.apply(S.scala:1674)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun$apply$42$$anonfun$apply$43.apply(S.scala:1672)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun$apply$42.apply(S.scala:1671)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1.apply(S.scala:1670)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$class.net$liftweb$http$S$$_innerInit(S.scala:1669)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_init$2$$anonfun$apply$50$$anonfun$apply$51$$anonfun$apply$52$$anonfun$apply$53$$anonfun$apply$54.apply(S.scala:1711)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_init$2$$anonfun$apply$50$$anonfun$apply$51$$anonfun$apply$52$$anonfun$apply$53.apply(S.scala:1709)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16$$anonfun$apply$17$$anonfun$apply$18$$anonfun$apply$19.apply(Vars.scala:611)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16$$anonfun$apply$17$$anonfun$apply$18.apply(Vars.scala:610)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16$$anonfun$apply$17.apply(Vars.scala:609)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16.apply(Vars.scala:608)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$class.apply(Vars.scala:607)
        at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:507)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_init$2$$anonfun$apply$50$$anonfun$apply$51$$anonfun$apply$52.apply(S.scala:1708)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16$$anonfun$apply$17$$anonfun$apply$18$$anonfun$apply$19.apply(Vars.scala:611)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16$$anonfun$apply$17$$anonfun$apply$18.apply(Vars.scala:610)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16$$anonfun$apply$17.apply(Vars.scala:609)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$$anonfun$apply$16.apply(Vars.scala:608)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.CoreRequestVarHandler$class.apply(Vars.scala:607)
        at net.liftweb.http.TransientRequestVarHandler$.apply(Vars.scala:520)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_init$2$$anonfun$apply$50$$anonfun$apply$51.apply(S.scala:1707)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_init$2$$anonfun$apply$50.apply(S.scala:1706)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_init$2.apply(S.scala:1705)
        at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:71)
        at net.liftweb.http.S$class.net$liftweb$http$S$$_init(S.scala:1704)
        at net.liftweb.http.S$class.init(S.scala:1284)
        at net.liftweb.http.S$.init(S.scala:47)
        at net.liftweb.http.LiftServlet$$anonfun$17.apply(LiftServlet.scala:709)
        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.apply(AbstractPartialFunction.scala:36)
        at net.liftweb.actor.LiftActor$class.execTranslate(LiftActor.scala:504)
        at net.liftweb.http.LiftServlet$ContinuationActor.execTranslate(LiftServlet.scala:667)
        at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$proc2(LiftActor.scala:307)
        at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply$mcV$sp(LiftActor.scala:229)
        at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:229)
        at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:229)
        at net.liftweb.actor.SpecializedLiftActor$class.around(LiftActor.scala:243)
        at net.liftweb.http.LiftServlet$ContinuationActor.around(LiftServlet.scala:667)
        at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$processMailbox(LiftActor.scala:228)
        at net.liftweb.actor.SpecializedLiftActor$$anonfun$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(LiftActor.scala:192)
        at bootstrap.liftweb.Boot$$anonfun$setupLiftScheduler$1$$anon$1$$anon$2.run(Boot.scala:168)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
 

Antonio Salazar Cardozo

unread,
Mar 15, 2015, 10:54:48 PM3/15/15
to lif...@googlegroups.com
Got it. Yeah, I think it's just a broken assumption and that code needs to stop
assuming it will get a Some just because that was checked ahead of time…
Should be pretty easy; if you file an issue I'll try to get to it sometime this coming
weekend.
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Mar 15, 2015, 11:02:28 PM3/15/15
to lif...@googlegroups.com
På mandag 16. mars 2015 kl. 03:54:47, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
Got it. Yeah, I think it's just a broken assumption and that code needs to stop
assuming it will get a Some just because that was checked ahead of time…
Should be pretty easy; if you file an issue I'll try to get to it sometime this coming
weekend.
Thanks,
Antonio
 

Antonio Salazar Cardozo

unread,
Mar 16, 2015, 10:15:31 AM3/16/15
to lif...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages