diff options
author | Miguel de Icaza <miguel@gnome.org> | 2007-07-06 02:07:05 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2007-07-06 02:07:05 +0400 |
commit | 3c2f76b3001523ae712dcba5b2311a196eb9399d (patch) | |
tree | 69f04767a2a947a4492dd4446938d15ae7031bd7 | |
parent | de58a8ba02bc5710ee881cda3698d7d8f3657c9d (diff) |
Backport of trunk/81442mono-1-2-4
svn path=/branches/mono-1-2-4/mcs/; revision=81443
-rw-r--r-- | mcs/class/System.Web/System.Web/ChangeLog | 26 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/HttpApplication.cs | 44 |
2 files changed, 44 insertions, 26 deletions
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index e594801c26e..d9abc9ed7db 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,29 @@ +2007-07-05 Miguel de Icaza <miguel@novell.com> + + * HttpApplication.cs (AsyncRequestState.Complete): Add the + try/catch for the callback here to ensure that we only call + complete_event.Set once. + + (PipelineDone): This is where the core of the bug fix is: do not + call Complete() or call done.Set() (depending on the invocation + case) until we are actually done cleaning up the request. + + The problem was that we signaled that we were done, but we had not + completed the shut down, so another thread could have been + scheduled on the same HttpApplication and had its variables be + modified as we completed the shutdown on the first thread. + + This fixes #81400 which was a very long standing bug. + + (Tick): Remove the pipeline check against null, this is not + necessary and it will help us find problems like this one in the + future. + + Reverts patch r66072 which was a described as: + + band-aid patch to help debugging hang running 2.0 + tests. + 2007-04-24 Marek Habersack <mhabersack@novell.com> * CapabilitiesLoader.cs: Hashtables used as property containers diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 74f478c0207..769cb20fe7b 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -626,9 +626,6 @@ namespace System.Web { // void ProcessError (Exception e) { - if (context == null) - context = HttpContext.Current; - bool first = context.Error == null; context.AddError (e); if (first){ @@ -652,8 +649,8 @@ namespace System.Web { void Tick () { try { - if (pipeline != null && pipeline.MoveNext ()){ - if (pipeline == null || (bool)pipeline.Current) + if (pipeline.MoveNext ()){ + if ((bool)pipeline.Current) PipelineDone (); } } catch (ThreadAbortException taex) { @@ -842,8 +839,6 @@ namespace System.Web { } catch (Exception e) { Console.WriteLine ("Internal error: OutputPage threw an exception " + e); } finally { - if (context == null) - context = HttpContext.Current; context.WorkerRequest.EndOfRequest(); if (factory != null && context.Handler != null){ factory.ReleaseHandler (context.Handler); @@ -853,29 +848,18 @@ namespace System.Web { #if NET_2_0 context.PopHandler (); #endif - if (begin_iar != null){ - try { - begin_iar.Complete (); - } catch { - // - // TODO: if this throws an error, we have no way of reporting it - // Not really too bad, since the only failure might be - // `HttpRuntime.request_processed' - // - } finally { - done.Set (); - } - } else { - done.Set (); - } - // context = null; -> moved to PostDone pipeline = null; current_ai = null; } PostDone (); - } + if (begin_iar != null) + begin_iar.Complete (); + else + done.Set (); + } + // // Events fired as described in `Http Runtime Support, HttpModules, // Handling Public Events' @@ -1310,8 +1294,16 @@ namespace System.Web { internal void Complete () { completed = true; - if (cb != null) - cb (this); + try { + // + // TODO: if this throws an error, we have no way of reporting it + // Not really too bad, since the only failure might be + // `HttpRuntime.request_processed'. + // + if (cb != null) + cb (this); + } catch { + } complete_event.Set (); } |