Bug 6229 - ConcurrentStack and ValueTypes larger than 12 bytes (Mono 2.10+)
Summary: ConcurrentStack and ValueTypes larger than 12 bytes (Mono 2.10+)
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 2.10.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Jérémie Laval
Depends on:
Reported: 2012-07-22 12:35 UTC by Gonzalo Paniagua Javier
Modified: 2012-11-15 10:28 UTC (History)
6 users (show)

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

Test case (2.33 KB, text/plain)
2012-07-22 12:35 UTC, Gonzalo Paniagua Javier

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 Gonzalo Paniagua Javier 2012-07-22 12:35:59 UTC
Created attachment 2243 [details]
Test case

From an email by: Yuriy Solodkyy

It looks like the ConcurrentStack does not work with big enough
structures anymore.  12 bytes struct is enough to reproduce the
problem occasionally, 16 bytes structure to reproduce it immediately.
It worked fine in mono 2.8.  The following code shows that we may pop
inconsistent structure from the stack from time to time.
Comment 1 Yuriy 2012-07-24 06:08:57 UTC
The sample code is available here: https://github.com/ysw/mono-socket-problem/tree/master/ConcurrentTest

Note, typically if app does not crash in the beginning it doesn't crash at all.

You need to run 8-cores to observe it quite frequently. 

Environment: Linux x64
Comment 2 Zoltan Varga 2012-08-07 17:01:33 UTC
I sometimes get this when running the testcase:

Unhandled Exception:
System.IndexOutOfRangeException: Array index is out of range.
  at (wrapper stelemref) object:virt_stelemref_class (intptr,object)
  at System.Collections.Concurrent.ObjectPool`1[System.Collections.Concurrent.ConcurrentStack`1+Node[CocurrentTest.MainClass+Data]].Release (System.Collections.Concurrent.Node obj) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.ConcurrentStack`1[CocurrentTest.MainClass+Data].TryPop (CocurrentTest.Data& result) [0x00000] in <filename unknown>:0 
  at CocurrentTest.MainClass+<Main>c__AnonStorey0.<>m__0 (System.Object v) [0x00000] in <filename unknown>:0 
  at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0 

is this the same problem you are running into ?
Comment 3 Zoltan Varga 2012-08-07 17:20:47 UTC
I can't reproduce the above issue with mono master any more.
Comment 4 Jérémie Laval 2012-08-07 17:30:48 UTC
Could have been fixed by either 2ac4d350e21a0551cd66bd1d98f121c135c12e84 or 37c812036b161b7636698ed5256c6e3b2770e063
Comment 5 Jérémie Laval 2012-11-15 10:28:55 UTC
I'll mark this as fixed since it doesn't seem to happen anymore. Don't hesitate to reopen if you still see the issue.