[Mono-bugs] [Bug 31177][Maj] Changed - Accept in Socket code has a race condition.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
25 Sep 2002 02:56:46 -0000


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 miguel@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=31177

--- shadow/31177	Tue Sep 24 22:53:09 2002
+++ shadow/31177.tmp.14124	Tue Sep 24 22:56:45 2002
@@ -86,6 +86,64 @@
 [pid  8829] <... bind resumed> )        = 0
 [pid  8827] <... rt_sigprocmask resumed> [RTMIN], 8) = 0
 [pid  8829] accept(10,  <unfinished ...>
 [pid  8827] rt_sigprocmask(SIG_UNBLOCK, [RTMIN],  <unfinished ...>
 [pid  8829] <... accept resumed> 0, NULL) = -1 EINVAL (Invalid argument)
 
+
+------- Additional Comments From miguel@ximian.com  2002-09-24 22:56 -------
+More information:
+
+Breakpoint 1, ves_icall_System_Net_Sockets_Socket_Accept_internal
+(sock=11) at socket-io.c:554
+554
+	newsock=accept(sock, NULL, 0);
+(gdb) p sock
+$1 = 11
+(gdb) n
+Server started.
+555
+	if(newsock==INVALID_SOCKET) {
+(gdb) p newsock
+$2 = 4294967295
+(gdb) n
+556
+		mono_raise_exception(get_socket_exception(WSAGetLastError()));
+(gdb) p/x newsock
+$3 = 0xffffffff
+(gdb) p getpid ()
+$4 = 8888
+
+Now notice this:
+
+mc$ ls -l /proc/8888/fd
+total 0
+lrwx------    1 miguel   miguel         64 Sep 24 22:56 0 -> /dev/pts/11
+lrwx------    1 miguel   miguel         64 Sep 24 22:56 1 -> /dev/pts/11
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 10 ->
+/mono/lib/System.dll
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 11 ->
+/mono/lib/System.Xml.dll
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 12 ->
+/mono/lib/System.Drawing.dll
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 14 ->
+pipe:[405978]
+l-wx------    1 miguel   miguel         64 Sep 24 22:56 15 ->
+pipe:[405978]
+lrwx------    1 miguel   miguel         64 Sep 24 22:56 16 ->
+socket:[405979]
+lrwx------    1 miguel   miguel         64 Sep 24 22:56 2 -> /dev/pts/11
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 3 ->
+/mono/bin/mono
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 4 ->
+/mono/bin/mono
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 5 ->
+/mono/lib/corlib.dll
+lrwx------    1 miguel   miguel         64 Sep 24 22:56 6 ->
+socket:[405972]
+lrwx------    1 miguel   miguel         64 Sep 24 22:56 7 ->
+socket:[405975]
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 8 ->
+/cvs/xsp/src/HttpServer/server.exe
+lr-x------    1 miguel   miguel         64 Sep 24 22:56 9 ->
+/mono/lib/System.Web.dll
+