[Mono-dev] [Fwd: [Mono-patches] r60310 - trunk/mono/mono/metadata]
Atsushi Eno
atsushi at ximian.com
Sun May 7 23:41:48 EDT 2006
Hi Zoltan,
Seems like it started to cause sharing violation on win32 build.
(r60309 built fine.)
make[8]: Entering directory `/home/atsushi/svn/mcs/class/corlib'
Creating ../../build/deps/default_corlib.dll.response ...
MONO_PATH="../../class/lib/net_1_1_bootstrap;$MONO_PATH"
/home/atsushi/svn/mono/runtime/mono-wrapper
../../class/lib/net_1_1_bootstrap/mcs.exe /codepage:28591
-nowarn:169,612,618,649 -d:INSIDE_CORLIB /nologo /optimize -d:NET_1_1
-d:ONLY_1_1 /debug+ /debug:full /noconfig -unsafe -nostdlib
-resource:resources/collation.core.bin
-resource:resources/collation.tailoring.bin
-resource:resources/collation.cjkCHS.bin
-resource:resources/collation.cjkCHT.bin
-resource:resources/collation.cjkJA.bin
-resource:resources/collation.cjkKO.bin
-resource:resources/collation.cjkKOlv2.bin -target:library
-out:mscorlib.dll @../../build/deps/default_corlib.dll.response
System\Int32.cs(146,33): warning CS0168: The variable `e' is declared
but never used
System.Security.Permissions\FileIOPermission.cs(531,30): warning CS0162:
Unreachable code detected
System\MonoType.cs(188,8): warning CS0219: The variable `typesLen' is
assigned but its value is never used
Compilation succeeded - 3 warning(s)
A: 0
A: 3
A: 1
A: 1
A: 1
MONO_PATH="../../class/lib/net_1_1_bootstrap;$MONO_PATH"
/home/atsushi/svn/mono/
runtime/mono-wrapper ../../class/lib/net_1_1_bootstrap/sn.exe -q -R
mscorlib.dll ../../class/mono.snk
Unhandled Exception: System.IO.IOException: Sharing violation on path
mscorlib.dll
in <0x00336> System.IO.FileStream:.ctor (System.String name, FileMode
mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean
anonymous, FileOptions options)
in <0x0001f> System.IO.FileStream:.ctor (System.String name, FileMode
mode, FileAccess access, FileShare share)
in (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor
(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
in <0x00021> System.IO.File:OpenWrite (System.String path)
in <0x0012e> Mono.Security.StrongName:Sign (System.String fileName)
in <0x00124> Mono.Tools.SN:ReSign (System.String assemblyName,
System.Security.Cryptography.RSA key)
in <0x008ca> Mono.Tools.SN:Main (System.String[] args)
make[8]: *** [../../class/lib/default/mscorlib.dll] Error 1
make[8]: Leaving directory `/home/atsushi/svn/mcs/class/corlib'
make[7]: *** [do-all] Error 2
make[7]: Leaving directory `/home/atsushi/svn/mcs/class/corlib'
make[6]: *** [all-recursive] Error 1
make[6]: Leaving directory `/home/atsushi/svn/mcs/class'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/home/atsushi/svn/mcs'
make[4]: *** [profile-do--default--all] Error 2
make[4]: Leaving directory `/home/atsushi/svn/mcs'
make[3]: *** [profiles-do--all] Error 2
make[3]: Leaving directory `/home/atsushi/svn/mcs'
make[2]: *** [all-local] Error 2
make[2]: Leaving directory `/home/atsushi/svn/mono/runtime'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/atsushi/svn/mono'
make: *** [all] Error 2
I tried to sign some core assemblies using external (already
installed) sn.exe to go on, but the same problem still happened
on other assemblies, so I think the runtime incorrectly locks
the target assembly file.
Atsushi Eno
-------- Original Message --------
Subject: [Mono-patches] r60310 - trunk/mono/mono/metadata
Date: Fri, 5 May 2006 13:17:50 -0400 (EDT)
From: Zoltan Varga (vargaz AT gmail.com)
<mono-patches-list at lists.ximian.com>
To: mono-patches at lists.ximian.com, ximian.monolist at gmail.com,
mono-patches-list at googlegroups.com
Author: zoltan
Date: 2006-05-05 13:17:49 -0400 (Fri, 05 May 2006)
New Revision: 60310
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/assembly.c
trunk/mono/mono/metadata/domain.c
trunk/mono/mono/metadata/image.c
trunk/mono/mono/metadata/metadata-internals.h
Log:
2006-05-05 Zoltan Varga <vargaz at gmail.com>
* metadata-internals.h image.c assembly.c: Change the reference
counting scheme
to also allow for temporary references between mono_image_open ()/close ().
* domain.c (get_runtimes_from_exe): Add a FIXME.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2006-05-05 17:13:26 UTC (rev 60309)
+++ trunk/mono/mono/metadata/ChangeLog 2006-05-05 17:17:49 UTC (rev 60310)
@@ -1,3 +1,10 @@
+2006-05-05 Zoltan Varga <vargaz at gmail.com>
+
+ * metadata-internals.h image.c assembly.c: Change the reference
counting scheme
+ to also allow for temporary references between mono_image_open
()/close ().
+
+ * domain.c (get_runtimes_from_exe): Add a FIXME.
+
2006-05-04 Zoltan Varga <vargaz at gmail.com>
* marshal.c: Fix support for dynamic methods.
Modified: trunk/mono/mono/metadata/assembly.c
===================================================================
--- trunk/mono/mono/metadata/assembly.c 2006-05-05 17:13:26 UTC (rev 60309)
+++ trunk/mono/mono/metadata/assembly.c 2006-05-05 17:17:49 UTC (rev 60310)
@@ -1193,24 +1193,6 @@
return NULL;
}
-static MonoImage*
-do_mono_assembly_open (const char *filename, MonoImageOpenStatus
*status, gboolean refonly)
-{
- MonoImage *image = NULL;
-
- if (bundles != NULL){
- image = mono_assembly_open_from_bundle (filename, status, refonly);
-
- if (image != NULL)
- return image;
- }
- mono_assemblies_lock ();
- image = mono_image_open_full (filename, status, refonly);
- mono_assemblies_unlock ();
-
- return image;
-}
-
MonoAssembly *
mono_assembly_open_full (const char *filename, MonoImageOpenStatus
*status, gboolean refonly)
{
@@ -1256,8 +1238,17 @@
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY,
"Assembly Loader probing location: '%s'.", filename);
- image = do_mono_assembly_open (fname, status, refonly);
+ image = NULL;
+ if (bundles != NULL)
+ image = mono_assembly_open_from_bundle (fname, status, refonly);
+
+ if (!image) {
+ mono_assemblies_lock ();
+ image = mono_image_open_full (filename, status, refonly);
+ mono_assemblies_unlock ();
+ }
+
if (!image){
*status = MONO_IMAGE_ERROR_ERRNO;
g_free (fname);
@@ -1280,6 +1271,9 @@
mono_config_for_assembly (ass->image);
}
+ /* Clear the reference added by mono_image_open */
+ mono_image_close (image);
+
g_free (fname);
return ass;
@@ -1386,6 +1380,7 @@
ass->ref_only = refonly;
ass->image = image;
+ /* Add a non-temporary reference because of ass->image */
mono_image_addref (image);
mono_assembly_fill_assembly_name (image, &ass->aname);
@@ -2204,6 +2199,8 @@
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Unloading
assembly %s [%p].", assembly->aname.name, assembly);
+ printf ("A: %d\n", assembly->image->ref_count);
+
mono_assemblies_lock ();
loaded_assemblies = g_list_remove (loaded_assemblies, assembly);
mono_assemblies_unlock ();
Modified: trunk/mono/mono/metadata/domain.c
===================================================================
--- trunk/mono/mono/metadata/domain.c 2006-05-05 17:13:26 UTC (rev 60309)
+++ trunk/mono/mono/metadata/domain.c 2006-05-05 17:17:49 UTC (rev 60310)
@@ -1,4 +1,3 @@
-
/*
* domain.c: MonoDomain functions
*
@@ -1447,6 +1446,12 @@
return;
}
+ /*
+ * FIXME: This would cause us to unload the image, and it will be
loaded again later.
+ * Disabling it will mean the initial exe will not be unloaded on
shutdown.
+ */
+ //mono_image_close (image);
+
runtimes [0] = get_runtime_by_version (image->version);
runtimes [1] = NULL;
}
Modified: trunk/mono/mono/metadata/image.c
===================================================================
--- trunk/mono/mono/metadata/image.c 2006-05-05 17:13:26 UTC (rev 60309)
+++ trunk/mono/mono/metadata/image.c 2006-05-05 17:17:49 UTC (rev 60310)
@@ -834,6 +834,7 @@
image->image_info = iinfo;
image->name = canonicalize_path (fname);
image->ref_only = refonly;
+ image->ref_count = 1;
return do_mono_image_load (image, status, care_about_cli);
}
@@ -967,6 +968,7 @@
g_free (absfname);
if (image){
+ mono_image_addref (image);
mono_images_unlock ();
return image;
}
@@ -984,7 +986,9 @@
* @fname: filename that points to the module we want to open
* @status: An error condition is returned in this field
*
- * Returns: An open image of type %MonoImage or NULL on error.
+ * Returns: An open image of type %MonoImage or NULL on error.
+ * The caller holds a temporary reference to the returned image which
should be cleared
+ * when no longer needed by calling mono_image_close ().
* if NULL, then check the value of @status for details on the error
*/
MonoImage *
Modified: trunk/mono/mono/metadata/metadata-internals.h
===================================================================
--- trunk/mono/mono/metadata/metadata-internals.h 2006-05-05 17:13:26
UTC (rev 60309)
+++ trunk/mono/mono/metadata/metadata-internals.h 2006-05-05 17:17:49
UTC (rev 60310)
@@ -63,7 +63,8 @@
/*
* The number of assemblies which reference this MonoImage though
their 'image'
* field plus the number of images which reference this MonoImage
through their
- * 'modules' field. Initially 0.
+ * 'modules' field, plus the number of threads holding temporary
references to
+ * this image between calls of mono_image_open () and mono_image_close ().
*/
int ref_count;
FILE *file_descr;
_______________________________________________
Mono-patches maillist - Mono-patches at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
More information about the Mono-devel-list
mailing list