[Mono-bugs] [Bug 541492] New: TcpListener.AcceptSocket() sometimes throw ThreadAbortedException after listener is stopped
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Sep 23 14:32:09 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=541492
Summary: TcpListener.AcceptSocket() sometimes throw
ThreadAbortedException after listener is stopped
Classification: Mono
Product: Mono: Class Libraries
Version: 2.4.x
Platform: x86-64
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: oskar.berggren at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14)
Gecko/2009090217 Ubuntu/9.04 (jaunty) Firefox/3.0.14
I have code that starts a TcpListener, and then calls AcceptSocket() on it.
Another thread then comes along and calls Stop() on the listener.
On MS .Net this seems to cause AcceptSocket() to throw a SocketException, with
error code indicating interrupted system call. It seems difficult to find clear
documentation on how this issue should work, but the mentioned behavior seems
reasonable.
On Mono, I have also experienced the described SocketException, but very often
I seem to get a ThreadAbortedException instead, with the following stack trace:
System.Threading.ThreadAbortException: Thread was being aborted
at (wrapper managed-to-native)
System.ComponentModel.Win32Exception:W32ErrorMessage (int)
at System.ComponentModel.Win32Exception..ctor (Int32 error) [0x00000] in
/home/oskar/mono24/mono-2.4.2.3/mono-2.4.2.3/mcs/class/System/Assembly/AssemblyInfo.cs:1
at System.Net.Sockets.SocketException..ctor (Int32 error) [0x00000] in
/home/oskar/mono24/mono-2.4.2.3/mono-2.4.2.3/mcs/class/System/Assembly/AssemblyInfo.cs:1
at System.Net.Sockets.Socket.Accept () [0x000b8] in
/home/oskar/mono24/mono-2.4.2.3/mono-2.4.2.3/mcs/class/System/System.Net.Sockets/Socket.cs:1434
at System.Net.Sockets.TcpListener.AcceptSocket () [0x00016] in
/home/oskar/mono24/mono-2.4.2.3/mono-2.4.2.3/mcs/class/System/System.Net.Sockets/TcpListener.cs:193
at XXX.TriggerServer.Run_impl () [0x0003b] in MYCODE
at XXX.TriggerServer.Run () [0x00000] in MYCODE
This makes it difficult to detect and ignore an expected exception while
shutting down the listener, while not ignoring too much.
Reproducible: Always
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list