Minor issue in 3.1: MockWeb's LiftSession.destroySession raises exception in stdout

10 views
Skip to first unread message

j...@joescii.com

unread,
Dec 6, 2017, 4:04:16 PM12/6/17
to Lift
While migrating a Lift app from 2.6 to 3.1 and found what turned out to be a benign exception in the console. It occurs if you happen to destroy the LiftSession used in MockWeb.testS. 

For instance, following code in a spec2 Specification...

MockWeb.testS("http://localhost:9090")(
S.session.map(_.destroySession())
)

... will cause the following exception in the console: 

14:48:02.269 [pool-10-thread-1] ERROR net.liftweb.actor.ActorLogger - Actor threw an exception

java.lang.NullPointerException: null

at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936) ~[na:1.8.0_131]

at net.liftweb.http.SessionMaster$$anonfun$3.applyOrElse(SessionMaster.scala:205) ~[lift-webkit_2.11-3.1.0.jar:3.1.0]

at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) ~[scala-library-2.11.11.jar:1.0.1]

at net.liftweb.actor.LiftActor$class.execTranslate(LiftActor.scala:504) ~[lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.http.SessionMaster$.execTranslate(SessionMaster.scala:42) [lift-webkit_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$proc2(LiftActor.scala:305) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply$mcV$sp(LiftActor.scala:227) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:227) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$$anonfun$net$liftweb$actor$SpecializedLiftActor$$processMailbox$1.apply(LiftActor.scala:227) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$class.around(LiftActor.scala:241) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.http.SessionMaster$.around(SessionMaster.scala:42) [lift-webkit_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$class.net$liftweb$actor$SpecializedLiftActor$$processMailbox(LiftActor.scala:226) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.SpecializedLiftActor$$anonfun$2$$anonfun$apply$mcV$sp$1.apply$mcV$sp(LiftActor.scala:190) [lift-actor_2.11-3.1.0.jar:3.1.0]

at net.liftweb.actor.LAScheduler$$anonfun$9$$anon$2$$anon$3.run(LiftActor.scala:76) [lift-actor_2.11-3.1.0.jar:3.1.0]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]

at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]


This doesn't happen in 2.6. 

The good news is the test doesn't fail. It just cost us some time discovering where this new exception was coming from.

Note the exception happens even when destroying the LiftSession outside of the testS function (which happened to be what our test was trying to do)

I have a sample project demonstrating the behavior. Run "sbt clean update test" in my 2.6 and 3.1 branches. 

Any objections to patching this to avoid future confusion? And if so, should we wait for the 3.2 cycle since this issue is both minor and not likely to be common?

Joe

Matt Farmer

unread,
Dec 8, 2017, 2:41:05 PM12/8/17
to lif...@googlegroups.com
I’d say go ahead and issue a patch and we’ll include it in 3.2-RC1 if you can get it done by next week. :)
--
--
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.

Joe Barnes

unread,
Dec 11, 2017, 1:48:55 PM12/11/17
to lif...@googlegroups.com
Cool, I'll get on it!

Joe


/**
 * Joe Barnes
 * Owner/Principal Consultant, joescii, llc
 */


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.

--
--
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+unsubscribe@googlegroups.com.

Joe Barnes

unread,
Dec 11, 2017, 6:43:57 PM12/11/17
to lif...@googlegroups.com
Both an issue and a PR have been opened.

Joe


/**
 * Joe Barnes
 * Owner/Principal Consultant, joescii, llc
 */


Reply all
Reply to author
Forward
0 new messages