[Mono-devel-list] Segmentation fault in mono_class_from_name

Kamil Skalski nazgul at nemerle.org
Wed Jun 23 04:22:54 EDT 2004


I'm trying to hunt a bug in mono runtime, which appeared somewhere befero 
Beta1 and lasts till now. I'm having a NullReference when opening Npgsql 
connection, but my investigations show, that it is not Npgsql / System.Net 
related problem, but some really internal runtime bug. 

So what exactly is happening:
GetHostByName_internal calls 
	return_value = hostent_to_IPHostEntry2(hp1, hp2, h_name, h_aliases,
					       h_addr_list);
which calls
       	family_hint = get_family_hint ();
which calls
    	socket_class = mono_class_from_name (system_assembly,
					     "System.Net.Sockets", "Socket");

and inside mono_class_from_name, line
       	nspace_table = g_hash_table_lookup (image->name_cache, name_space);

fails with null reference.

Probably there is some null key inside this name_cache hashtable... Note, that 
this bug is triggered only in presence of Nemerle compiler, so it's probably 
some System.Reflection.Emit realted issue.

My question is how can I easily assert somewhere  that image-> name_cache is 
holding valid data? 

As I debugged a little bit mono_class_from_name it seems that it is being 
called something about 26 times (and succesfully ends each execution) from 
inside g_hash_table_lookup (image->name_cache, name_space); but finally 
fails.

Note, that this is a first time I've ever dig into mono runtime, so I don't 
have any knowledge about assumptions and algorithms used there.

(With a little effort you can reproduce this bug installing Nemerle compiler, 
where it is always reproducable)

Any hints?

Kamil Skalski



More information about the Mono-devel-list mailing list