Bug 11999 - Async/await crashes with assertion: condition `domain' not met
Summary: Async/await crashes with assertion: condition `domain' not met
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.7.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-04-27 00:05 UTC by Ben Dodson
Modified: 2013-05-02 10:53 UTC (History)
2 users (show)

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


Attachments
Test case (1.64 KB, application/octet-stream)
2013-04-27 00:14 UTC, Ben Dodson
Details
Logcat from test case (2.87 KB, text/plain)
2013-05-01 15:09 UTC, Ben Dodson
Details
Simplified test case (1.69 KB, application/octet-stream)
2013-05-01 15:10 UTC, Ben Dodson
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 on Developer Community or GitHub 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:
Status:
RESOLVED FIXED

Description Ben Dodson 2013-04-27 00:05:36 UTC
I have some async/await code that runs well on Mono.Mac and Xamarin.IOS, but consistently crashes on Android. I've attached a piece of sample code that appears to reproduce the bug.
Comment 1 Ben Dodson 2013-04-27 00:14:48 UTC
Created attachment 3885 [details]
Test case
Comment 2 Ben Dodson 2013-04-29 13:13:47 UTC
Some more details I had originally posted to the forums: I have some concurrently network code that makes heavy use of async/await. It runs fine on Xamarin.iOS and Mono.mac. But when I run the code on Xamarin.Android (Version: 4.7.4 (Indie Edition)), I get a SIGSEGV about 7 times out of 10.

Interestingly, there's a particular line of code I've toggled on and off, which should do nothing more than add another network connection into the mix. When the line is enabled, I see the crash frequently, and when it's disabled, I rarely crash at all.

Another curious data point is that right around when the SIGSEGV hits, one of the network tasks faults with a "connection reset by peer". What's interesting is we would be much more likely to encounter this exception on the other network connection, so I was wondering if it was possible for the tasks generated by async/await to be getting their flows mixed up.
Comment 3 Jonathan Pryor 2013-04-30 22:19:13 UTC
I'm unable to easily reproduce on my Nexus 10/Android 4.2.

What target device and Android version are you testing on? Is it armeabi or armeabi-v7a or x86?

> I get a SIGSEGV about 7 times out of 10.

Can you please provide the full logcat output?

> When the line is enabled, I see the crash frequently, and when it's disabled,
> I rarely crash at all.

Which line is this? I don't see anything in the source code that mentions this.

> Another curious data point is that right around when the SIGSEGV hits, one of
> the network tasks faults with a "connection reset by peer".

Is it from the same PID?
Comment 4 Ben Dodson 2013-05-01 15:08:49 UTC
The writeup is regarding our app, which is different from the test case I attached. That crash was from the x86 simulator running in non-debug mode. The following is the test case that stably reproduces the crash for us, running on a few devices including Nexus S, under debug mode. We think the debugger has something to do with it, as we can't stably reproduce when running without it.

We've also ruled out async/await as the main culprit here-- we've reduced the test case to run our network connections in tasks and still get the fault.
Comment 5 Ben Dodson 2013-05-01 15:09:29 UTC
Created attachment 3903 [details]
Logcat from test case
Comment 6 Ben Dodson 2013-05-01 15:10:24 UTC
Created attachment 3904 [details]
Simplified test case

Causes stable crash when the debugger is attached. Test case does not reproduce crash without the debugger.
Comment 7 Jonathan Pryor 2013-05-02 10:53:10 UTC
I"m unable to reproduce the crash in the debugger with 4.7.5.257139499, so I hope/assume that it will be fixed in the next beta release.

I suspect that this is a dup of Bug #11858 (same assert).