Bug 39888 - [Android M] Disposing a large amount of sockets while a connect operation is in progress leads to an ART error on Android Marshmallow
Summary: [Android M] Disposing a large amount of sockets while a connect operation is ...
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2016-03-24 14:45 UTC by lukas
Modified: 2017-06-29 08:27 UTC (History)
3 users (show)

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


Attachments
Simple project containing the bug (12.00 KB, application/x-zip-compressed)
2016-03-24 14:45 UTC, lukas
Details


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 for Bug 39888 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description lukas 2016-03-24 14:45:20 UTC
Created attachment 15517 [details]
Simple project containing the bug

I made an app which needs to scan networks for specific hosts. More precisely I want to create a list of all hosts with whom the connection was successfully established on a specific port.
e.g. find all reachable hosts from 192.168.0.1 to 192.168.0.255 on port 80

The standard timeout for a connect operation is roughly 2 minutes and definitely too high for my purpose. Therefore I had to find a way to set a timeout. The only intended way to do this is by using the static CancelConnectAsync method of the Socket class. See https://msdn.microsoft.com/library/system.net.sockets.socket.cancelconnectasync(v=vs.110).aspx
Xamarin Android however does not support this method. My workaround for this is to forcefully stop the ongoing connect by closing the socket. So far it worked really well. On Android Marshmallow however the app crashes after doing so by no later than 255 times.

I attached a simple test case and created a video of it here:
http://www.screencast.com/t/zIkKwvrinIx0

The log can be found here:
http://pastebin.com/1bBsj0MN

This is probably the most important line.
03-24 10:17:54.031: A/art(1604): art/runtime/fault_handler.cc:117] Check failed: !initialized_