Lift eats Comet update failure

63 views
Skip to first unread message

Donald McLean

unread,
Jul 17, 2014, 11:18:36 AM7/17/14
to liftweb
I have a Comet actor on a page and discovered that a recent change in my code was pushing an update to the client that was invalid.

Unfortunately, Lift was eating the error message and so I had no way of knowing where the problem lie and no easy way of figuring it out.

Soooo, have I egregiously overlooked something and the error messages are actually supposed to be somewhere (log on server)? Or does Lift need to be modified so that these error messages DO come out somewhere?

Thank you,

Donald

Diego Medina

unread,
Jul 17, 2014, 12:01:35 PM7/17/14
to lif...@googlegroups.com
What kind of error was it?

Was the invalid update,  invalid JavaScript?
--
--
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

Donald McLean

unread,
Jul 17, 2014, 2:43:39 PM7/17/14
to liftweb
Hi Diego,

I'm not sure what the error was (it was getting eaten) - I had to figure out what was causing it by backing out specific changes until it worked and then figuring out what was wrong.

The problem turned out to be with this:

JsRaw("console.log('[doReinstallCallback] Generated from lift.';")

There was a missing close paren immediately before the semi-colon. This statement became part of a JavaScript function that was created on the Lift side and contained an ajaxCall.

Thank you,

Donald
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Diego Medina

unread,
Jul 17, 2014, 2:55:32 PM7/17/14
to Lift
this would not happen on the server side, so Lift doesn't have a way to know there was an error and log it on the server side.
most of the time when I have some error in my js that goes out using comet, it results in the client getting an error (javascript alert message) that says something along the lines of, cannot contact server ...



Donald McLean

unread,
Jul 17, 2014, 3:34:37 PM7/17/14
to liftweb
What I don't understand is:

a) No error messages come out on the client (Lift client side stuff eating them?)
b) The server is repeatedly re-sending the update. Of course, it keeps failing and so the app is effectively dead (sometimes reloading the page helps).

Joe Barnes

unread,
Jul 17, 2014, 3:35:24 PM7/17/14
to lif...@googlegroups.com
If I recall correctly, I've seen these errors show up in my Chrome console rather than as alert messages.  See if they show up there for you.
Joe
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.



--

Diego Medina

unread,
Jul 17, 2014, 3:36:06 PM7/17/14
to Lift
On Thu, Jul 17, 2014 at 3:34 PM, Donald McLean <dmcl...@gmail.com> wrote:
What I don't understand is:

a) No error messages come out on the client (Lift client side stuff eating them?)

this I haven't seen, this is where  I normally see an error mesage, what lift version? at least 2.5.1 showed a message
 
b) The server is repeatedly re-sending the update. Of course, it keeps failing and so the app is effectively dead (sometimes reloading the page helps).



it retries 3 times and then it gives up, again, this was on 2.5.1

Antonio Salazar Cardozo

unread,
Jul 18, 2014, 12:16:14 AM7/18/14
to lif...@googlegroups.com
Nope, this is actually a much more pernicious problem that I've seen many times. It is indeed a bit of a pain, but it's also a bit
hard to solve. When the JS hits the client, jQuery attempts to eval it as JavaScript. But, when it goes to do that, the JavaScript
fails to parse, so nothing gets to run! This means that the JS sent down from the server never runs at all. However, the jQuery
AJAX handler does invoke the comet failure function—which is designed to deal with connection errors, not JS parse errors.
The reaction to a comet request's failure is to try again (I think in 10s?), so we try another comet request. However, it's the JS
that comes from the server that lets us know what the latest update we've seen from the server is. Since the JS didn't run, our
version didn't update, which means the comet sees that we're out of date and sends us the original update as well as anything
else that has happened since then! Net-net, we get the bad JS again, and the cycle starts over.

We may be able to update the failure handler to look for what error jQuery tells us it got—but the problem is that our AJAX stuff
is designed to work with jQuery, YUI, and one or two other libraries, which means we'd have to make sure they all reported a JS
parse error the same way, or that we implemented handling for all the different ways in the failure callback. Either way, things get
pretty nasty.

Hope that sheds some light onto why this is happening, despite not offering an immediate solution. Thanks for bringing it up; this
has bit me before (though not since we switched to using events+JSON to send things down to the client as a matter of course),
and it can be quite frustrating.
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.


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

--
--
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.

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



--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

--
--
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.

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



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

--
--
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.

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



--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

--
--
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.

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

Joe Barnes

unread,
Jul 18, 2014, 9:31:50 AM7/18/14
to lif...@googlegroups.com
Ah, that makes sense.  The failures I've seen in my console have been from valid JS hitting undefined, etc.

I understand your point regarding handling the failures from different libraries.  If we merely wanted to log the failure in the browser console, do you suppose that would be more manageable? 

Joe

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.



--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

--
--
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

--
--
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.



--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

--
--
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.

Antonio Salazar Cardozo

unread,
Jul 18, 2014, 10:47:25 AM7/18/14
to lif...@googlegroups.com
No matter our approach, we'd need to detect the error, and that's something that I think is only provided in the failure callback,
maybe? But it's definitely worth investigating (and maybe all the libraries report a JS parse error the same way—I haven't had a
chance to investigate that either).
Thanks,
Antonio

fmpwizard

unread,
Aug 21, 2014, 9:37:44 AM8/21/14
to lif...@googlegroups.com
@Antonio: would you say we need a ticket for this or is it already in your master plan to tackle this? :)

Antonio Salazar Cardozo

unread,
Aug 21, 2014, 10:57:13 AM8/21/14
to lif...@googlegroups.com
A ticket is actually a great idea! :) This is an issue that keeps slipping off my radar because it's only annoying
when it happens, and it happens to me very rarely because I structure almost all comet JavaScript as a single
JsCmd that dispatches an event on the client. So I haven't run into it in a loong time.

A ticket would ensure it gets to stay on the radar :)
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Aug 21, 2014, 11:44:47 AM8/21/14
to lif...@googlegroups.com
På torsdag 21. august 2014 kl. 16:57:13, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
A ticket is actually a great idea! :) This is an issue that keeps slipping off my radar because it's only annoying
when it happens, and it happens to me very rarely because I structure almost all comet JavaScript as a single
JsCmd that dispatches an event on the client. So I haven't run into it in a loong time.
 
A ticket would ensure it gets to stay on the radar :)
Thanks,
Antonio
 
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 

Diego Medina

unread,
Aug 21, 2014, 12:10:32 PM8/21/14
to Lift


 

--
--
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.

Donald McLean

unread,
Aug 21, 2014, 12:40:20 PM8/21/14
to liftweb
Thank you!


On Thu, Aug 21, 2014 at 12:10 PM, Diego Medina <di...@fmpwizard.com> wrote:

Reply all
Reply to author
Forward
0 new messages