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

Chris Seaton chris at chrisseaton.com
Wed May 16 11:51:54 EDT 2007


Aaah! It must be a memory thing then! I'm so glad someone else is  
experiencing this.

Chris

On 16 May 2007, at 16:45, 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...
>
> Now I don't know if it is related to the bug you describe, but it  
> sures look
> like the same problem.
>
> Jonathan
>
> -----Message d'origine-----
> De : mono-list-bounces at lists.ximian.com
> [mailto:mono-list-bounces at lists.ximian.com] De la part de Chris Seaton
> Envoyé : Wednesday, May 16, 2007 11:23 AM
> À : Robert Jordan
> Cc : Mono-list at lists.ximian.com
> Objet : Re: [Mono-list] My program randomly doesn't work with Mono
>
> No, the program doesn't hang. The program logic acts differently  
> even though
> the input is exactly the same. There are no threads, only IO is  
> reading from
> a file that I am positive is not changing, no date time  
> calculations, no
> random numbers, no networking, no libraries, no external programs,  
> nothing.
> I am positive the program should run exactly the same each time,  
> but it
> doesn't. And then when I put a Console.WriteLine in to see where it  
> might be
> going wrong, it sometimes magically works again. The program is far  
> too big
> to submit as a test case.
>
> Any ideas?
>
> Chris Seaton
>
> On 16 May 2007, at 12:51, Robert Jordan wrote:
>
>> Hi,
>>
>> Chris Seaton wrote:
>>> I ran it several times in GDB and managed to reproduce the problem,
>>> but GDB didn't say that anything went wrong.
>>
>> When the program is hanging again, send it a SIQUIT:
>>
>> 	kill -QUIT <pid-of-the-prog>
>>
>> The runtime will dump a backtrace of all threads.
>>
>> If you are proficient with GDB (see http://mono-project.com/
>> Debugging), you could interrupt the debugger with Ctrl-C and call the
>> "mono_backtrace" macro.
>>
>> After you've got a backtrace (either from SIGQUIT or gdb), go to
>> http://mono-project.com/Bugs and file a bug for the "Runtime"
>> component, preferably with a small test case.
>>
>> Robert
>>
>>
>>>
>>> Chris
>>>
>>> On 16 May 2007, at 12:03, joeri Belis wrote:
>>>
>>>> Does it work when run from a debugger environment?
>>>>
>>>> -----Oorspronkelijk bericht-----
>>>> Van: mono-list-bounces at lists.ximian.com
>>>> [mailto:mono-list-bounces at lists.ximian.com] Namens Chris Seaton
>>>> Verzonden: woensdag 16 mei 2007 12:08
>>>> Aan: List Mono
>>>> Onderwerp: [Mono-list] My program randomly doesn't work with Mono
>>>>
>>>> Hi,
>>>>
>>>> Sorry for the very strange and vague issue report:
>>>>
>>>> My c sharp mono program randomly works and doesn't work. When I say
>>>> doesn't work - it doesn't crash - the program logic  inexplicably
>>>> fails - I know, I know, bear with me...
>>>>
>>>> My program has no IO apart from reading from files that I am
>>>> positive are not changing between runs. There is no network code.
>>>> There is no threading at all. There is no external process
>>>> launching. There are no libraries apart from System.*.
>>>>
>>>> When it suddenly stops working, if I put in a Console.WriteLine
>>>> statement to see what's going on at a certain point it will  
>>>> suddenly
>>>> work. And that's "Console.WriteLine("test")" - I'm not calling a
>>>> property or anything that could possibly have a side effect in
>>>> evaluating it.
>>>>
>>>> I've tried running my program on two separate installations of Mono
>>>> on a PowerPC OS X and an x86 Linux, one of those not being set  
>>>> up by
>>>> myself. I've tried 1.2.3.1 and 1.2.4 with the same problem. It's
>>>> very intermittent. I'll be working happily
>>>>
>>>> The only strange thing I do is a massive amount of dynamic code
>>>> emission. Lots of TypeBuilder and DynamicMethods. It also uses a
>>>> fair bit of memory, usually up to about 500 MB. I am positive that
>>>> there must be some subtle bug somewhere in Mono.
>>>>
>>>> I know this is no information to diagnose any problem, but has
>>>> anyone else had any kind of similar experience? Could anyone  
>>>> suggest
>>>> anything I could try? Remember, there is no crash - the output  
>>>> of my
>>>> program simply becomes wrong as if it branched incorrectly at some
>>>> point, or some bit of memory changed behind my back.
>>>>
>>>> Thanks
>>>>
>>>> Chris Seaton
>>>> _______________________________________________
>>>> 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
>>>
>>
>> _______________________________________________
>> 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
>



More information about the Mono-list mailing list