Re: Chunked response doesn't return all data and net::ERR_INCOMPLETE_CHUNKED_ENCODING

2,688 views
Skip to first unread message

Jean Maynier

unread,
Mar 19, 2015, 9:13:33 AM3/19/15
to play-fr...@googlegroups.com
We have the same error, did you find a solutioin ? 
Cheers

Jean 

Le jeudi 22 mai 2014 09:53:29 UTC+2, Amine Essaouis a écrit :
I forgot to mention that the amount of data transferred to UI varies from one browser to the other.

Thanks


On Thu, May 22, 2014 at 12:34 AM, Amine Essaouis <amine.e...@gmail.com> wrote:
Hello fellow Play/Scala developers.

I have a Play app that serves search results by calling another service using multiple requests. The responses to the different requests are sent as chunks. Basically the requests are all fired and as soon as a request is finished, the result is sent back using Comet: I use the iframe method described by Play's doc.

However, I noticed that in some cases, the iframe call finishes before all data has been sent back to the end user. I debugged a little and found that the requests eventually all finish and my browser shows a net::ERR_INCOMPLETE_CHUNKED_ENCODING.

Here is how my result looks like:

Ok.chunked(
      (stringEnumerator1 &> Comet(callback = "script1")) >-
      (stringEnumerator2 &> Comet(callback = "script2")) >-
      (stringEnumerator3 &> Comet(callback = "script3"))
).as(HTML)

As far as I read in Play's doc, this should the trick but it doesn't and I have no idea how to solve this. Does anyone have a slight idea or tip on this?

Thanks


--
Amine



--
Amine Essaouis
Computer Science Engineering Student | ENSEEIHT Toulouse
T +33-695-176-567

James RopR

unread,
Mar 19, 2015, 8:51:27 PM3/19/15
to play-framework
Is there a proxy between the browser and the Play server?

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



--
James RopR
Software Engineer

Typesafe – Build reactive apps!
Twitter: @jroper

Maynier, Jean

unread,
Mar 20, 2015, 3:12:59 AM3/20/15
to play-fr...@googlegroups.com

The app is hosted on heroku, so the connection pass by the heroku router, but no proxy. Because heroku close idle connection after 30s, we send heartbeat message every 25s to keep the SSE open.
We tried with Ok.chunked and Ok.feed methods. Feed seems to trigger less errors, but the documentation seems to say that chunked is more standard.
The play doc is lacking to explain which one to use in real cases.

--
Jean Maynier
Co-founder / CTO
@jmaynier

You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/2A-zJf1PIH0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

James RopR

unread,
Mar 22, 2015, 9:33:02 PM3/22/15
to play-framework
The Heroku router is a proxy (anything that proxies requests, eg load balancer, request router, etc, is a proxy).  So you'll get this exception when Heroku terminates the connection early.  There's nothing Play can do about that, it can't send the last chunk after Heroku has closed the connection.  If you really want to fix this, raise a request with Heroku to ask them to close chunked responses cleanly.

Igmar Palsenberg

unread,
Mar 23, 2015, 6:46:51 AM3/23/15
to play-fr...@googlegroups.com
 

The app is hosted on heroku, so the connection pass by the heroku router, but no proxy. Because heroku close idle connection after 30s, we send heartbeat message every 25s to keep the SSE open.
We tried with Ok.chunked and Ok.feed methods. Feed seems to trigger less errors, but the documentation seems to say that chunked is more standard.
The play doc is lacking to explain which one to use in real cases.

The router is actually a proxy. I suggest raising a ticket with Heroku, since this is not a play issue.



Igmar 

Joe Kutner

unread,
Mar 23, 2015, 4:22:49 PM3/23/15
to play-fr...@googlegroups.com
The Heroku router will close the connection if it does not see a "Transfer-Encoding: Chucked" header or a Content-Length header. But the Ok.chucked should take care of this for you as long as you write something to the output stream within 30 seconds.

Here's a really nice example of a Play helper class that does this:
https://github.com/jamesward/longjson/blob/master/app/controllers/ChunkBlower.java

Please open a ticket with Heroku if this doesn't help (you'll likely be put in touch with me).
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages