[Mono-list] My program randomly doesn't work with Mono

Jonathan Gagnon jonathan.gagnon at croesus.com
Thu May 17 07:51:22 EDT 2007


Hi,
 
I don't think it is related to my system setup since you reproduced a
similar problem using my serialization example (attached to this email) on
MacOS.  Here's what you answered to me on 5/10/2007 :
 
>So the problem is this (as far as i can make out). You're fragmenting the
heap and running out of "free" memory or the GC is just choking on the
amount of data you're spitting out. This is caused by two things. 
>1) The memorystream increasing in size
>2) A hashtable internal to mono constantly increasing in size while
serialisation is taking place.

>If you run your testcase with int num = 9000; instead of int num = 15000;
it works fine. So the best advice i can offer is to serialise your data in
smaller chunks for the moment. 

>Also, i never managed to get an OOM exception when running on MacOS, but
the program did seem to crash/hang.

>Alan. 
 
This is the same problem, although with the simpler hashtable example, it
happens not to crash/hang on your system.  I'm pretty sure that by changing
the number of iterations, you could make it crash.
 
I noticed that although my serialization example doesn't crash on Windows,
it doesn't behave properly.  I would expect the serialized stream to be the
same size at each iteration, since I serialize the same data every time.
But after a few iterations, the size of the stream begins to change and then
I never get the same size again, which is unexpected.  Also, the behavior is
not the same at every run, and I have been able to make the application hang
on Windows too, although it doesn't happen very often.  So it really looks
like a memory problem, which would explain the different behavior from one
OS to another.  In any case, I don't think it is a system setup problem, now
that I have been able to reproduce it on Windows.
 
I submitted it as a runtime bug yesterday (81642).
 
Jonathan


  _____  

De : Alan McGovern [mailto:alan.mcgovern at gmail.com] 
Envoyé : Wednesday, May 16, 2007 4:44 PM
À : Jonathan Gagnon
Cc : Chris Seaton; mono-list at lists.ximian.com
Objet : Re: [Mono-list] My program randomly doesn't work with Mono


I suppose it'd be worth submitting it as a runtime bug, but personally i
think it's an issue with your system setup. I can't see why the GC would
have a 2 gig heap when it's only allocated 1/10th of that.

Alan.


On 5/16/07, Jonathan Gagnon <jonathan.gagnon at croesus.com> wrote: 

I use Fedora Core 3 and mono 1.2.3.1.  I get the same problem when using
mono 1.2.4.  I  wanted to attach the outfile generated by heap-buddy but it
is too large for the mono-list.  I attached the "backtraces" and the "types"
outputs instead.  Here's the summary :

 
           SUMMARY
 
         Filename: outfile
  Allocated Bytes: 228.3M
Allocated Objects: 5000070
              GCs: 12
          Resizes: 328
  Final heap size: 2725.3M
 
   Distinct Types: 8
       Backtraces: 14 
 
 
Jonathan


  _____  

De : mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] De la part de Alan McGovern
Envoyé : Wednesday, May 16, 2007 12:05 PM
À : Chris Seaton
Cc : mono-list at lists.ximian.com
Objet : Re: [Mono-list] My program randomly doesn't work with Mono



Can i get both of you experiencing problems to either run your applications
with heap-prof or heap-buddy to generate some profiling statistics to help
figure out whats going wrong on your particular setup?

Also, what OS's and mono versions are you on that are causing these
problems? Is the behaviour the same with mono 1.2.4? Please test that before
filing any bug reports.

Alan.


On 5/16/07, Chris Seaton <chris at chrisseaton.com
<mailto:chris at chrisseaton.com> > wrote: 

The problem is intermittent. I can work on my program all day and
then suddenly it just starts failing. Stick a Console.WriteLine in
and it works again. Then it stops again and I take it out and it
works again!

Chris

On 16 May 2007, at 16:54, Ted Milker wrote:

> Just an FYI but none of these crash on FreeBSD 6.2 running mono
> 1.2.3.1
>
> Jonathan Gagnon wrote:
>> Hi,
>>
>> I too have different behaviors if I put a Console.WriteLine in my
>> code. 
>> Consider the following example :
>>
>> static void Main(string[] args)
>> {
>>     int num = 5000000;
>>     Hashtable table = new Hashtable();
>>     for (int i = 0; i < num; ++i) 
>>     {
>>         Object obj = new Object();
>>         table.Add(obj, obj);
>>     }
>> }
>>
>> That crashes somewhere inside the for loop.  But if I add a 
>> WriteLine at the
>> beginning like this :
>>
>> static void Main(string[] args)
>> {
>>     int num = 5000000;
>>     Console.WriteLine("WriteLine"); 
>>     Hashtable table = new Hashtable();
>>     for (int i = 0; i < num; ++i)
>>     {
>>         Object obj = new Object();
>>         table.Add(obj, obj);
>>     } 
>> }
>>
>> Everything works fine.  Then if I add another WriteLine at the end
>> followed
>> by a Thread.Sleep, it crashes again, but this time inside the
>> Thread.Sleep :
>>
>> static void Main(string[] args)
>> {
>>     int num = 5000000;
>>     Console.WriteLine("WriteLine");
>>     Hashtable table = new Hashtable();
>>     for (int i = 0; i < num; ++i) 
>>     {
>>         Object obj = new Object();
>>         table.Add(obj, obj);
>>     }
>>     Console.WriteLine("WriteLine");
>>     Thread.Sleep(10000);
>> }
>>
>> Any modifications to that code may lead to different behaviors.
>> Sometimes I
>> seem to end up being stuck in a infinite loop (with 2.8 gig of
>> allocated
>> virtual memory).  It seems like the size of the executable has an
>> impact on
>> the result...
>>
>
> _______________________________________________
> Mono-list maillist  -   Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

_______________________________________________ 
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070517/3703b5cb/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Serialization.cs
Url: http://lists.ximian.com/pipermail/mono-list/attachments/20070517/3703b5cb/attachment.pl 


More information about the Mono-list mailing list