Bug 20794 - ConcurrentQueue causes the app to halt and mono to stop responding
Summary: ConcurrentQueue causes the app to halt and mono to stop responding
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.12.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Marek Habersack
Depends on:
Reported: 2014-06-22 03:49 UTC by Rowan
Modified: 2016-09-21 20:16 UTC (History)
3 users (show)

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

sample app that shows the bug (53.31 KB, application/octet-stream)
2014-06-22 03:50 UTC, Rowan

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:

Description Rowan 2014-06-22 03:49:24 UTC
I have attached a very simple app that shows this issue.

All the app does is have 1 ConcurrentQueue with 1 thread continually adding to the queue and 3 other threads continually dequeuing items.

The screen is continuously flashing blue to show that the app is still alive

In less than 1 minute the screen will stop flashing and if you press pause on the debugger it can not halt the app.

The larger the byte array length being appended to the queue the quicker the app will die.

I no longer use ConcurrentQueue because of this bug, I just created my own thread safe queue class so I am not waiting on this to be fixed. However the behaviour is very similar to bug https://bugzilla.xamarin.com/show_bug.cgi?id=20360. As that bug uses multiple threads and the fail is the same. Execution is halted, the debugger no longer responds, and no message in the android log. As this one is much more repeatable investigating this issue could shed some light on the other bug (which is stopping my app from being released).
Comment 1 Rowan 2014-06-22 03:50:38 UTC
Created attachment 7147 [details]
sample app that shows the bug
Comment 2 Udham Singh 2014-06-23 05:31:58 UTC
I have checked this issue with sample app provided in comment 1 and observed the same behavior mentioned in bug description.

Screencast : http://www.screencast.com/t/gkxm6p5IqW
Output Log : https://gist.github.com/saurabh360/0d3f4e414e4ce75aa61b

Environment Info :

Microsoft Visual Studio Professional 2013
Version 12.0.30501.00 Update 2
Microsoft .NET Framework
Version 4.5.51641

Xamarin (d3cf238e3845e930e312b6ec9b4c6c5437c33067)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android

Xamarin.Android (b5dc5ce91305e19de51d71a1122c109719c4bc34)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (d3cf238e3845e930e312b6ec9b4c6c5437c33067)
Visual Studio extension to enable development for Xamarin.iOS
Comment 3 Marek Habersack 2016-09-21 20:16:56 UTC
No longer occurs with the current Xamarin.Android. Tested with monodroid/master, commit ab8f5949bf6f54ce79266ca54fe94045710c0fe6