Skip to content
Browse files

Backport of trunk/81442

svn path=/branches/mono-1-2-4/mcs/; revision=81443
  • Loading branch information...
1 parent de58a8b commit 3c2f76b3001523ae712dcba5b2311a196eb9399d @migueldeicaza migueldeicaza committed Jul 5, 2007
Showing with 44 additions and 26 deletions.
  1. +26 −0 mcs/class/System.Web/System.Web/ChangeLog
  2. +18 −26 mcs/class/System.Web/System.Web/HttpApplication.cs
View
26 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
View
44 mcs/class/System.Web/System.Web/HttpApplication.cs
@@ -626,9 +626,6 @@ public virtual string GetVaryByCustomString (HttpContext context, string custom)
//
void ProcessError (Exception e)
{
- if (context == null)
- context = HttpContext.Current;
-
bool first = context.Error == null;
context.AddError (e);
if (first){
@@ -652,8 +649,8 @@ void ProcessError (Exception e)
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 @@ void PipelineDone ()
} 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 @@ void PipelineDone ()
#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 @@ internal AsyncRequestState (ManualResetEvent complete_event, AsyncCallback cb, o
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 ();
}

0 comments on commit 3c2f76b

Please sign in to comment.
Something went wrong with that request. Please try again.