Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=77651 --- shadow/77651 2006-02-27 06:31:00.000000000 -0500 +++ shadow/77651.tmp.31945 2006-02-27 06:31:00.000000000 -0500 @@ -0,0 +1,81 @@ +Bug#: 77651 +Product: Mono: Compilers +Version: 1.1 +OS: GNU/Linux [Other] +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Cosmetic +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Runtime crashes if the .exe being run is recompiled + +Description of Problem: +When gmcs compiles a previously compiled source, it overwrites the original +.exe file's contents. If that file is being executed, the unexpected file +modification makes mono crash (except some trivial cases where there's no +further code to be executed from the file). + +There's no straightforward way to avoid it in the runtime (the .exe would +have to be locked or held all in the memory). However, this can be easily +avoided that gmcs triggers the issue. gcc on a compilation first issues an +unlink(2) on the target file. This way, the target file content's change is +invisible to the processes that already hold the file open (another inode +is written to). + +I believe Mono should also unlink the target .exe file before writing the +compilation output. + +Steps to reproduce the problem: +A quick sample of how the issue can be triggered: +1. Prepare x1.cs with the contents: +using System; +using System.Threading; +class X { +static void Main() { +Thread.Sleep(15000); +B(); +} +static void B() { +Console.WriteLine(5); +} +} +2. Prepare x2.cs with the contents: +using System; +using System.Threading; +class X { +static void Main() { +Thread.Sleep(15000); +B(4); +} +static void B(int i) { +Console.WriteLine(i); +} +} +3. Issue the command sequence: +cp x1.cs x.cs +gmcs x.cs +mono x.exe& +cp x2.cs x.cs +gmcs x.cs +4. Wait until the Sleep runs out. + +Actual Results: +** ERROR ** : file loader.c: line 1667 (mono_method_get_header): assertion +failed: (loc) +aborting + +Expected Results: +"5" on the console + +How often does this happen? +The crash itself is not very deterministic. It depends on various factors, +with different code samples I saw various assertion failures triggered, in +some cases the execution proceeded without obstruction. The file overwrite +happens 100%. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
