I cannot reproduce the problem either. What exact version of 2.10 did you test against? It's possible the bug has already been fixed in a newer release of the 2.10 series.
Alan On 23 July 2012 13:32, Rodrigo Kumpera <kump...@gmail.com> wrote: > Hi Yuriy, > > With how many cores and on what CPU did managed to reproduce this? > I'm running this on my 4 cores nehalem mac without any luck. I'll diff > ConcurrentStack > between 2.8 and 2.10 to see what could be. > > On Sun, Jul 22, 2012 at 5:10 AM, Yuriy Solodkyy <yu...@couldbedone.com> > wrote: >> >> Hi, >> >> 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. >> >> using System; >> using System.Collections.Concurrent; >> namespace CocurrentTest { >> class MainClass { >> struct Data { >> public int A; public int B; public int C; public >> int D; >> public Data(int v) { >> A = v; B = -v; C = v; D = -v; >> } >> } >> >> public static void Main (string[] args) { >> Console.WriteLine ("Hello World!"); >> var data = new byte[1024 * 1024]; >> var stack = new ConcurrentStack<Data> (); >> >> for (var i = 0; i < 50; i++) { >> >> var thread = new System.Threading.Thread >> (v => { >> >> var rnd = new Random (); >> while (true) { >> int pushCount = rnd.Next >> (50); >> int popCount = rnd.Next >> (50); >> >> for (var k = 0; k < >> pushCount; k++) { >> >> >> var sample = >> new Data (rnd.Next(Int32.MaxValue)); >> CheckSample >> (sample); >> >> stack.Push >> (sample); >> } >> >> for (var k = 0; k < >> popCount; k++) { >> Data >> retrievedSample = new Data(); >> if >> (stack.TryPop (out retrievedSample)) { >> >> CheckSample (retrievedSample); >> } >> } >> } >> } >> ); >> >> thread.Start (); >> } >> } >> >> static void CheckSample (Data sample){ >> if (sample.A != -sample.B || sample.A != >> sample.C || sample.B != sample.D) >> throw new Exception (string.Format >> ("Invalid sample detected")); >> } >> } >> } >> >> >> -- >> Yuriy Solodkyy >> _______________________________________________ >> Mono-devel-list mailing list >> Mono-devel-list@lists.ximian.com >> http://lists.ximian.com/mailman/listinfo/mono-devel-list > > > > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list