Bug 42180 - SocketAsyncTest.SendAsync failure on Android
Summary: SocketAsyncTest.SendAsync failure on Android
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer ()
Version: 4.6.0 (C8)
Hardware: Other Other
: --- major
Target Milestone: 4.8.0 (C9)
Assignee: Ludovic Henry
Depends on:
Reported: 2016-06-27 08:19 UTC by Alex Rønne Petersen
Modified: 2016-12-02 18:29 UTC (History)
6 users (show)

Is this bug a regression?: Yes
Last known good build: Mono 4.4

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alex Rønne Petersen 2016-06-27 08:19:13 UTC
We're seeing the following failure on Android:

> MonoTests.System.Net.Sockets.SocketAsyncTest.SendAsync=Timeout #1
> 		  at MonoTests.System.Net.Sockets.SocketAsyncTest.SendAsync () [0x00078] in /Users/builder/data/lanes/1196/b0e167d8/source/monodroid/tests/bcl-test/src/System/Test/System.Net.Sockets/SocketAsyncTest.cs:109 
> 		  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
> 		  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builder/data/lanes/1196/b0e167d8/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:309
Comment 1 Alex Rønne Petersen 2016-08-29 08:48:20 UTC
Still occurs on XA master.
Comment 2 Andi McClure 2016-09-07 19:55:01 UTC
Is this related to https://bugzilla.xamarin.com/show_bug.cgi?id=43172 ?

And does this occur in user usage or only in tests? 43172 has some property where it requires a flag only the tests set.
Comment 3 Luis Aguilera 2016-09-12 20:13:09 UTC
since C8 is now closed, and is shipping this week, I will move this but to the C8SR1 milestone. We'll continue working on the issue seeking it's resolution as soon as possible.
Comment 4 Andi McClure 2016-12-02 15:45:09 UTC
I am trying to figure out if this bug is still occurring.

I ran the test which fails, on my test phone (Nexus 5x running 6.0.1). It failed, but in a different place. The test creates a socket on localhost, connects to it, then receives and sends data on it. In the trace attached to this bug, it hangs when it tries to receive data. In my test it only got as far as trying to connect to the local socket, then it hangs. Then things got odder. When I rebooted the phone, the test ran perfectly. I was able to run it 35 times in a loop, then it went back into the state where it always hangs on connecting to the local socket. I traced our socket creation/polling code and there does not seem to be much space for a bug or race here. We appear to be doing the right thing and the client socket simply does not connect.

Questions I have at this point include:

1. Is this bug still present?
2. Is the problem I am seeing on my phone the same?
3. If there is a bug (or two), is it our bug or Android’s? Marek H tells me Android started doing some seriously weird stuff with local sockets around Android 6 (and localhost might not even be present on some phones?)
4. Given this seems very possibly to be an Android OS bug, is it more appropriate for the runtime team or the Android team to be investigating this?
5. Is support for incoming connections on a socket on an Android device even something we support? Do people do that on a phone? What is this test trying to test, and is there something more reasonable it could be testing on Android instead of local sockets (for example, named pipes)?

I’ve asked QA to scan over their recent wrench results and see if they are still seeing this bug on physical devices in C9/master.
Comment 5 Peter Collins 2016-12-02 18:27:24 UTC
I ran this test against monodroid/cycle9/72366f70 on a few devices and was unable to reproduce locally:

HTC Flyer v2.3.3  - 105 ran, 105 passed.
LG Nexus 5x v7.0 - 10 ran, 10 passed.
Google Pixel v7.1 - 10 ran, 10 passed.

The HTC Flyer had a historic failure in this test which I was able to identify in previous cycle8 results, but recent cycle9 results are clean. I think it's safe to resolve this bug as not reproducible.
Comment 6 Andi McClure 2016-12-02 18:29:03 UTC
I'm gonna upgrade this nexus 5x and if i still see issues i'll file a separate bug.