Bug 322070 (MONO79361) - [XSP] Exception when stoping Mono.WebServer.ApplicationServer
Summary: [XSP] Exception when stoping Mono.WebServer.ApplicationServer
Status: RESOLVED FIXED
Alias: MONO79361
Product: Mono: Tools
Classification: Mono
Component: XSP (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Gonzalo Paniagua Javier
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-11 21:33 UTC by Jean-Francois Burdet
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:09:37 UTC


---- Reported by jfburdet@humanweb.ch 2006-09-11 14:33:53 MST ----

Description of Problem:

XSP is launching Mono.WebServer.ApplicationServer, but when the thread is 
stopped, an ObjectDisposed exception is thrown from OnAccept (IAsyncResult 
ares)

Steps to reproduce the problem:
1. Start XSP
2. Hit enter in the console to stop it

Actual Results:
- an exception is launced

Expected Results:
- XSP should stops quietly

How often does this happen? 
- every time

Additional Information:
- I believe that that problem could be solved by adding a inner try/catch 
in the finally block because like : 

void OnAccept (IAsyncResult ares)
		{
			Socket accepted = null;
			try {
				accepted = listen_socket.EndAccept (ares);
			} catch {
			} finally {
                try
                {
                    listen_socket.BeginAccept(accept_cb, null);
                }
                catch (ObjectDisposedException) { }
            }

			if (accepted == null)
				return;
			accepted.Blocking = true;
			SetSocketOptions (accepted);
			StartRequest (accepted, 0);
		}

Since I'm not an expert, this should be confirmed by a Mono dev.



---- Additional Comments From gonzalo@ximian.com 2006-09-11 15:04:35 MST ----

Can you try with this change instead?

Index: ApplicationServer.cs
===================================================================
--- ApplicationServer.cs        (revision 64953)
+++ ApplicationServer.cs        (working copy)
@@ -329,7 +329,8 @@
                                accepted = listen_socket.EndAccept (ares);
                        } catch {
                        } finally {
-                               listen_socket.BeginAccept (accept_cb,
null);
+                               if (started)
+                                       listen_socket.BeginAccept
(accept_cb, null);
                        }

                        if (accepted == null)




---- Additional Comments From jfburdet@humanweb.ch 2006-09-11 15:19:02 MST ----

Hi Gonzalo,

I tried your change, and it works : no exception (beside "1st chance 
exception" that can be seen only in the debugger) are thrown.



---- Additional Comments From gonzalo@ximian.com 2006-09-11 16:31:17 MST ----

Fixed in r65253.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>XP SP2 / Visual Studio 2005</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".