Project

General

Profile

[error] "Http::ResponseContinuation: WriteError"

Added by Long Nguyễn Đức over 9 years ago

I am trying to stream media file through WMediaPlayer or WVideo from WFileResource or direct link. However, whenever the media player is loading the media file, I keep getting error log: [error] "Http::ResponseContinuation: WriteError" . That stops me from seeking time in the player. And the session's getting destroyed immidately. If I compile the same code on Cloud9 IDE, the error is not present in the log and seeking time is fine. What is the source of this problem and how can I solve it?

Log:

./server.wt --http-addr 0.0.0.0 --http-port 6969 --docroot ".;/resources" --config ./wt_config.xml
[2015-Aug-28 11:16:50.685230] 31018 - [info] "config: reading Wt config file: ./wt_config.xml (location = './server.wt')"
[2015-Aug-28 11:16:50.686590] 31018 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2015-Aug-28 11:16:50.686907] 31018 - [info] "wthttp: started server: http://0.0.0.0:6969"
[2015-Aug-28 11:17:03.262490] 31018 - [info] "Wt: session created (#sessions = 1)"
[2015-Aug-28 11:17:03.262692] 31018 [/ TfRAe5sZhgBomY0S] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
127.0.0.1 - - [2015-Aug-28 11:17:03.535441] "GET /test2 HTTP/1.1" 200 2638
[2015-Aug-28 11:17:03.535532] 31018 - [info] "WebRequest: took 273.161ms"
127.0.0.1 - - [2015-Aug-28 11:17:03.786967] "GET /test2?wtd=TfRAe5sZhgBomY0S&request=style HTTP/1.1" 200 119
[2015-Aug-28 11:17:03.787085] 31018 - [info] "WebRequest: took 236.999ms"
127.0.0.1 - - [2015-Aug-28 11:17:03.878057] "GET /resources/themes/default/wt.css HTTP/1.1" 304 0127.0.0.1 - - [2015-Aug-28 11:17:03.878057] "GET /resources/webkit-transitions.css HTTP/1.1" 304 0

127.0.0.1 - - [2015-Aug-28 11:17:03.878172] "GET /resources/jPlayer/skin/jplayer.blue.monday.css HTTP/1.1" 304 0
127.0.0.1 - - [2015-Aug-28 11:17:03.973944] "GET /test2?wtd=TfRAe5sZhgBomY0S&sid=-1178941303&webGL=true&tz=420&htmlHistory=true&deployPath=%2F&request=script&rand=418362609 HTTP/1.1" 200 91512
[2015-Aug-28 11:17:03.974029] 31018 - [info] "WebRequest: took 312.257ms"
127.0.0.1 - - [2015-Aug-28 11:17:04.050869] "GET /resources/jPlayer/jquery.jplayer.min.js HTTP/1.1" 304 0
127.0.0.1 - - [2015-Aug-28 11:17:04.120969] "GET /resources/jPlayer/skin/jplayer.blue.monday.video.play.png HTTP/1.1" 304 0
127.0.0.1 - - [2015-Aug-28 11:17:04.121296] "GET /resources/jPlayer/skin/jplayer.blue.monday.jpg HTTP/1.1" 304 0
127.0.0.1 - - [2015-Aug-28 11:17:04.208285] "POST /?wtd=TfRAe5sZhgBomY0S HTTP/1.1" 200 51
[2015-Aug-28 11:17:04.208286] 31018 - [info] "Wt: session created (#sessions = 2)"
[2015-Aug-28 11:17:04.208396] 31018 - [info] "WebRequest: took 0.516ms"
[2015-Aug-28 11:17:04.208532] 31018 [/ 7YCmrTSv9B5KFtcr] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
127.0.0.1 - - [2015-Aug-28 11:17:04.209769] "GET /favicon.ico HTTP/1.1" 200 2643
[2015-Aug-28 11:17:04.209949] 31018 - [info] "WebRequest: took 1.785ms"
[2015-Aug-28 11:17:04.354008] 31018 - [error] "Http::ResponseContinuation: WriteError"
[2015-Aug-28 11:17:04.354168] 31018 - [info] "WebRequest: took 108.941ms"
[2015-Aug-28 11:17:13.587093] 31018 [/ 7YCmrTSv9B5KFtcr] [info] "WebController: timeout: expiring"
[2015-Aug-28 11:17:13.587222] 31018 [/ 7YCmrTSv9B5KFtcr] [info] "Wt: session destroyed (#sessions = 1)"
127.0.0.1 - - [2015-Aug-28 11:17:13.587251] "GET /test2?wtd=TfRAe5sZhgBomY0S&request=style HTTP/1.1" 200 20
[2015-Aug-28 11:17:13.587427] 31018 - [info] "WebRequest: took 0.459ms"
[2015-Aug-28 11:17:18.488528] 31018 - [info] "Wt: session created (#sessions = 2)"
[2015-Aug-28 11:17:18.488808] 31018 [/ wSjLXsX9UnE3bjJo] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
127.0.0.1 - - [2015-Aug-28 11:17:18.489956] "GET /test2 HTTP/1.1" 200 2642
[2015-Aug-28 11:17:18.490035] 31018 - [info] "WebRequest: took 1.623ms"
127.0.0.1 - - [2015-Aug-28 11:17:18.552140] "GET /test2?wtd=wSjLXsX9UnE3bjJo&request=style HTTP/1.1" 200 119
[2015-Aug-28 11:17:18.552240] 31018 - [info] "WebRequest: took 39.983ms"
127.0.0.1 - - [2015-Aug-28 11:17:18.582753] "GET /test2?wtd=wSjLXsX9UnE3bjJo&sid=1014631036&webGL=true&tz=420&htmlHistory=true&deployPath=%2F&request=script&rand=3593340217 HTTP/1.1" 200 91524
[2015-Aug-28 11:17:18.582851] 31018 - [info] "WebRequest: took 31.859ms"
127.0.0.1 - - [2015-Aug-28 11:17:18.593294] "GET /resources/jPlayer/skin/jplayer.blue.monday.css HTTP/1.1" 200 10708
127.0.0.1 - - [2015-Aug-28 11:17:18.598858] "GET /resources/webkit-transitions.css HTTP/1.1" 200 5947
127.0.0.1 - - [2015-Aug-28 11:17:18.605403] "GET /resources/themes/default/wt.css HTTP/1.1" 200 19983
127.0.0.1 - - [2015-Aug-28 11:17:18.686386] "GET /resources/jPlayer/jquery.jplayer.min.js HTTP/1.1" 200 49431
127.0.0.1 - - [2015-Aug-28 11:17:18.727336] "GET /resources/jPlayer/skin/jplayer.blue.monday.video.play.png HTTP/1.1" 200 17692
127.0.0.1 - - [2015-Aug-28 11:17:18.727750] "GET /resources/jPlayer/skin/jplayer.blue.monday.jpg HTTP/1.1" 200 23189
[2015-Aug-28 11:17:18.791065] 31018 - [info] "Wt: session created (#sessions = 3)"
[2015-Aug-28 11:17:18.791207] 31018 [/ BGXzNn4TfPuOjNNK] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
127.0.0.1 - - [2015-Aug-28 11:17:18.792138] "GET /favicon.ico HTTP/1.1" 200 2643
[2015-Aug-28 11:17:18.792215] 31018 - [info] "WebRequest: took 1.246ms"
127.0.0.1 - - [2015-Aug-28 11:17:18.813476] "POST /?wtd=wSjLXsX9UnE3bjJo HTTP/1.1" 200 50
[2015-Aug-28 11:17:18.813563] 31018 - [info] "WebRequest: took 0.429ms"
[2015-Aug-28 11:17:18.924293] 31018 - [error] "Http::ResponseContinuation: WriteError"
[2015-Aug-28 11:17:18.924453] 31018 - [info] "WebRequest: took 82.436ms"
[2015-Aug-28 11:17:48.796406] 31018 [/ BGXzNn4TfPuOjNNK] [info] "WebController: timeout: expiring"
[2015-Aug-28 11:17:48.796474] 31018 [/ BGXzNn4TfPuOjNNK] [info] "Wt: session destroyed (#sessions = 2)"
127.0.0.1 - - [2015-Aug-28 11:17:48.796620] "POST /?wtd=wSjLXsX9UnE3bjJo HTTP/1.1" 200 50
[2015-Aug-28 11:17:48.796700] 31018 - [info] "WebRequest: took 0.406ms"
[2015-Aug-28 11:18:14.767076] 31018 [/ TfRAe5sZhgBomY0S] [info] "WebController: timeout: expiring"
[2015-Aug-28 11:18:14.767389] 31018 [/ TfRAe5sZhgBomY0S] [info] "Wt: session destroyed (#sessions = 1)"
127.0.0.1 - - [2015-Aug-28 11:18:18.796276] "POST /?wtd=wSjLXsX9UnE3bjJo HTTP/1.1" 200 50
[2015-Aug-28 11:18:18.796341] 31018 - [info] "WebRequest: took 0.326ms"
127.0.0.1 - - [2015-Aug-28 11:18:44.819205] "POST /?wtd=wSjLXsX9UnE3bjJo HTTP/1.1" 200 130
[2015-Aug-28 11:18:44.819293] 31018 - [info] "WebRequest: took 0.592ms"
[2015-Aug-28 11:18:44.821110] 31018 [/ wSjLXsX9UnE3bjJo] [info] "Wt: session destroyed (#sessions = 0)"
[2015-Aug-28 11:18:44.843904] 31018 - [info] "WebRequest: took 30077ms"

Replies (13)

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Emeric Poupon over 9 years ago

I hit the "Http::ResponseContinuation: WriteError" problem from time to time, too.

I use a WMediaPlayer that transcodes data using a custom underlying WResource.

I am not sure how to reproduce this, but it happens when serving large amount of data (> 15MB, by chunks of 128KB)

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Koen Deforche over 9 years ago

Hey,

The WriteError can be expected if the browser closes the connection to the resource (which is known to happen). But this shouldn't exit your session. At least not with Wt 3.3.5rc1 (or latest git)? What Wt version are you seeing this problem with?

Koen

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Emeric Poupon over 9 years ago

Hello,

In my case this does not exit the session.

However, you said the browser is known to close the connection to the resource. Could you please tell me more on that? This is very annoying, since I generate the data on the fly during the connection to the resource.

Emeric

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Koen Deforche over 9 years ago

Hey Emeric,

The browser (or also proxies) may close the connection for several reasons: e.g. the user browses away, or because it thinks the response takes too long, or because it's not interested in the complete contents (e.g. typical for videos or audios), etc...

Koen

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Emeric Poupon over 9 years ago

Hello,

If I switch from my custom resource that uses continuations to a WMemoryResource, I have no more problems. Indeed the data is sent in one big chunk to the browser...

I have quite big files to send, I am wondering how big should be the data chunks?

You seem to use 8KB in the WFileResource, is that a good choice?

Regards,

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Emeric Poupon over 9 years ago

Hello,

Well, this annoying, I hit the same issue as initially reported. I use Chromium on an android device.

I write the first chunk of data and I get the Http::ResponseContinuation::Error just after.

I can't really say what I have changed to make this not work.

Maybe this is browser dependend?

Maybe the SSL layer has an impact on this problem?

BR,

Emeric

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Emeric Poupon over 9 years ago

Curiously, disabling the SSL layer solved the problem.

Unfortunately, this is not an acceptable situation :(

I tried with the latest git version right now.

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Koen Deforche over 9 years ago

Hey Emeric,

You only get it from time to time, or do you always get it on one particular device with a particular browser ?

The SSL layer should not have an impact once it's properly connected. We will only start handling a packet after all the SSL hand-shaking has been completed.

Koen

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Emeric Poupon over 9 years ago

Hi,

After investigating more, I noticed this behavior is only on mobile devices, with Chrome.

When I am loading the resource, I am doing this:

    _audio->pause();
    _audio->clearSources();
    _audio->addSource(SessionTranscodeResource()->getUrl(trackId, Av::Encoding::MP3, 0, streams));
    _audio->play();

In the log:

[2016-Jan-01 18:54:41.803631] 16065 [/ bBNoMgg786uHfHnf] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Linux; Android 4.4.2; LG-D802 Build/KOT49I.D80220h) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36"
...
[2016-Jan-01 18:54:49.799369] 16065 [/ ShZ53SFhkRLF27tQ] [info] "Wt: new session id for bBNoMgg786uHfHnf"
...
[2016-Jan-01 18:54:55.095538] 16065 [/ ShZ53SFhkRLF27tQ] [debug] - [UI] Handling new request...
-> The first log line in my custom resource
...
[2016-Jan-01 18:54:55.298519] 16065 [/ ShZ53SFhkRLF27tQ] [debug] - [UI] Written 65536 bytes! complete = 0
[2016-Jan-01 18:54:55.298560] 16065 [/ ShZ53SFhkRLF27tQ] [debug] - [UI] Continuation set to 0x7f5be405e190
-> The last log line in my custom resource
[2016-Jan-01 18:54:55.336024] 16065 - [error] "Http::ResponseContinuation: WriteError"

I tried with another chrome version (30): same thing

I tried with Firefox: it works!

What do you think?

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Jeremy Brisko almost 9 years ago

Was there ever any resolution to this. I'm having the exact same problem using a WStreamResource. I am using that and loading up an mp3 via the handleRequestPiecewise function. It works great on desktop browsers, however on Chrome and Safari on iOS I get this immediately when it tries to stream my file. Any tips would be greatly appreciated.

Thanks!

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Wim Dumon almost 9 years ago

Jeremy,

Is this also related to SSL? Does everything work properly without SSL?

Wim.

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Jeremy Brisko almost 9 years ago

Wim

My project is currently not using SSL. Any other info I can provide?

Thanks

RE: [error] "Http::ResponseContinuation: WriteError" - Added by Wim Dumon almost 9 years ago

The 'error' is not necessarily a bug in Wt - a browser can actually decide not to read the entire request and close the request at any time. When Wt tries to write to such a closed connection, it receives a write error, and reports it in the log.

Especially for media resources (in audio/video elements), I've seen this happening: browser queries the beginning of the file to know how large it is, then launches a request with range headers to fetch the metadata at the end of the file, and then launches another request (potentially also with range headers) to read the data. Is this what is happening? May there be an error in the way the range headers are processed in Wt?

Wim.

    (1-13/13)