Long AJAX responses are being truncated

1,318 views
Skip to first unread message

Gustav van der Merwe

unread,
Jan 29, 2015, 6:48:17 AM1/29/15
to lif...@googlegroups.com
I've had no issues when testing on localhost but when running on our collective test server I've had the situation where a long (~500kb) javascript response (kinda a JSON response but I'm doing it through an ajaxInvoke) is being truncated. Both are running under SBT so I can't think that there should be any issues there. I'm literally stumped as to what the issue is or where to debug/fix it.

Regards,
Gustav van der Merwe

signature.asc

Gustav van der Merwe

unread,
Jan 29, 2015, 7:37:16 AM1/29/15
to lif...@googlegroups.com
Ok, the deal is that the requests can take more than 5 seconds and this is the cut off point for truncation (not size).

This seems to be the default of jettys maxIdleTime (why is the time idle? it should be serving a request.).

So I want to add:

<init-param>
<param-name>maxIdleTime</param-name>
<param-value>10000</param-value>
</init-param>

to <filter> in web.xml to have Jetty use the longer maxIdleTime.

Except this seems to soundly ignored.

How does one configure the container in this regard? I would have assumed the LiftFilter would pass on the init-params to the servlet it would build. Am I wrong?

Regards,
Gustav van der Merwe

signature.asc

Diego Medina

unread,
Jan 29, 2015, 11:13:38 AM1/29/15
to Lift
Hi,

1- I would say that if your request is taking more than 5 seconds, you may want to rethink your approach and maybe use comet to give your users feedback when the resulting json is ready.
2- If for some reason that won't work for you, you can create a jetty.xml file and use this in build.sbt to tell sbt to read it:

configurationFiles in container.Configuration := Seq(file("jetty.xml"))

Thanks

Diego







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

Gustav van der Merwe

unread,
Jan 29, 2015, 11:21:40 AM1/29/15
to lif...@googlegroups.com
Actually, the request is an AJAX one so, yah, user waiting on feedback is expected (they get a spinny).

In the meantime I have found out there is a LiftServlet which has a HTTPContext (which may be a HTTPServletContext) but none of this seems to have set methods. Further, as we are talking about an init-param I would think it would be set in some configuration file prior to initialization.

Who around here is familiar with that plumbing? I am literally sitting on the outside of a big black box of spiky Java architecture (having not gotten to Scala through Java and J2EE).

I ended up adding GzipFilter to web.xml which works, 10x win with text of semi-repetitive js/json.

Regards,
Gustav van der Merwe

> To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com <mailto:liftweb%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Diego Medina
> Lift/Scala consultant
> di...@fmpwizard.com <mailto: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 <mailto:liftweb+u...@googlegroups.com>.
signature.asc

Antonio Salazar Cardozo

unread,
Jan 29, 2015, 1:53:57 PM1/29/15
to lif...@googlegroups.com, gv...@gvdm.me
I'm a little confused. Max AJAX request handling time is controlled by Lift, not Jetty, for one
thing (LiftRules.ajaxPostTimeout)—and it is set to 5s. But that's the time allowed for a single
AJAX request to compute a response. The AJAX request will retry if it exceeds 5s (up to 3
times, by default), and once the response is ready it does not cut off the process of sending
the response back.

Do you perchance have nginx or Amazon ELB some other reverse proxy in front of it that
may be imposing hard limits on response times?
Thanks,
Antonio
>     To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com <mailto:liftweb%2Bunsubscribe@googlegroups.com>.
>     For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Diego Medina
> Lift/Scala consultant
> di...@fmpwizard.com <mailto: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 <mailto:liftweb+unsubscribe@googlegroups.com>.

Gustav van der Merwe

unread,
Jan 29, 2015, 2:36:33 PM1/29/15
to lif...@googlegroups.com
It was actually 5s and then also 4 tries (1 + 3) before it failed. Working as expected, just not like I wanted. Turned out downloading half a meg can take longer than 5s/20s on my line.

Using gzip solved the transfer time.

Regards,
Gustav van der Merwe

>> <mailto:gv...@gvdm.me> <mailto:gv...@gvdm.me <mailto:gv...@gvdm.me>>>
>> liftweb+u...@googlegroups.com
>> <mailto:liftweb%2Bunsu...@googlegroups.com>
>> <mailto:liftweb%2Bunsu...@googlegroups.com
>> <mailto:liftweb%252Buns...@googlegroups.com>>. For more
>> options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>>
>>
>>
>>
>> -- Diego Medina Lift/Scala consultant di...@fmpwizard.com
>> <mailto:di...@fmpwizard.com> <mailto:di...@fmpwizard.com
>> <mailto: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
>> <http://groups.google.com/group/liftweb> Stuck? Help us help you:
>> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>> <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
>> <mailto:liftweb%2Bunsu...@googlegroups.com>
>> <mailto:liftweb+u...@googlegroups.com
>> <mailto:liftweb%2Bunsu...@googlegroups.com>>. For more options,
>> visit https://groups.google.com/d/optout
>> <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+u...@googlegroups.com
> <mailto:liftweb+u...@googlegroups.com>. For more options,
> visit https://groups.google.com/d/optout.


signature.asc

Antonio Salazar Cardozo

unread,
Jan 29, 2015, 11:45:49 PM1/29/15
to lif...@googlegroups.com, gv...@gvdm.me
Hmm… I wonder if jquery just stops waiting for the response to complete client-side once
you've passed 5s… It seems like that would be silly, but… Who knows. Could you file an
issue about this? It definitely doesn't feel like it's something that should happen, but doing
it differently will probably also have some implications that need thinking through.
Thanks,
Antonio
>> options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>>
>>
>>
>>
>> -- Diego Medina Lift/Scala consultant di...@fmpwizard.com
>> <mailto:di...@fmpwizard.com> <mailto:di...@fmpwizard.com
>> <mailto: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
>> <http://groups.google.com/group/liftweb> Stuck? Help us help you:
>> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>> <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
>> visit https://groups.google.com/d/optout
>> <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
Reply all
Reply to author
Forward
0 new messages