Bug 16855 - ServerSentEvent stream does not detect network is down
Summary: ServerSentEvent stream does not detect network is down
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler (show other bugs)
Version: 4.12.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2013-12-17 13:51 UTC by Gustavo Armenta
Modified: 2013-12-23 03:11 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:

Stream hanging sample (5.35 MB, application/x-zip-compressed)
2013-12-20 17:06 UTC, Gustavo Armenta

Description Gustavo Armenta 2013-12-17 13:51:39 UTC
This bug is similar to bug 16849

Start a http(s) request on Xamarin Android or iOS and the server side never
returns headers response initiating a Server Sent Events connection. Disconnect network cable, or on a physical device change to Airplane Mode. The standing stream.ReadAsync does not fail, it hangs.

Open attached solution
Run sample in an Android API 15 emulator
Let the sample run for 1 minute, notice there is a stream.readAsync completing every 10 seconds
Disconnect network cable, notice the application does not detect the failure, stream.readAsync just hangs
Comment 1 Sadik Ali 2013-12-19 08:21:17 UTC
Please attach the sample project
Comment 2 Jonathan Pryor 2013-12-20 15:48:31 UTC
Just as with https://bugzilla.xamarin.com/show_bug.cgi?id=16849#c1 network disconnects are notoriously difficult.

That said, are you enabling IOControlCode.KeepAliveValues?

Comment 3 Gustavo Armenta 2013-12-20 17:06:50 UTC
Created attachment 5709 [details]
Stream hanging sample
Comment 4 Sadik Ali 2013-12-23 03:10:18 UTC
I have verified this issue and reproduced at my end, following are the steps:

1. Download attached project.
2. Debug on API 15 and noticed a stream.readAsync printing in every 10 seconds
3. After 1 minute I unplugged internet connection.
4. stream.readAsync logging on app is stoped and no message displayed.
5. I connected internet again  and observed that stream.readAsync printed "Done" on application

Refer attached screenshot: http://screencast.com/t/1u2V1AjR

Checked With:

Win 7
XS 4.2.2 (build 2)
X.A. 4.10.1-68
API 15 emulator

Note You need to log in before you can comment on or make changes to this bug.