From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10603 invoked by alias); 9 Apr 2013 15:23:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10594 invoked by uid 89); 9 Apr 2013 15:23:09 -0000 X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 09 Apr 2013 15:23:08 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39FN55T025697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Apr 2013 11:23:06 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r39FN3UO012911; Tue, 9 Apr 2013 11:23:04 -0400 Message-ID: <51643257.7070002@redhat.com> Date: Tue, 09 Apr 2013 15:44:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb-patches@sourceware.org, Hui Zhu Subject: Re: [testsuite patch] race: server-kill.exp: Connection reset by peer [Re: [patch+7.6] Fix 7.5 regression crashing GDB if gdbserver dies] References: <20130315195359.GA19841@host2.jankratochvil.net> <514C50EF.6030202@redhat.com> <20130322191841.GA29259@host2.jankratochvil.net> <20130406192632.GA8832@host2.jankratochvil.net> In-Reply-To: <20130406192632.GA8832@host2.jankratochvil.net> Content-Type: multipart/mixed; boundary="------------060501060609010502010305" X-Virus-Found: No X-SW-Source: 2013-04/txt/msg00227.txt.bz2 This is a multi-part message in MIME format. --------------060501060609010502010305 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1771 On 04/06/2013 08:26 PM, Jan Kratochvil wrote: > On Fri, 22 Mar 2013 20:18:41 +0100, Jan Kratochvil wrote: >> +set server_pid [exp_pid -i [board_info target fileid]] >> +remote_exec target "kill -9 $server_pid" >> + >> +gdb_test "step" "Remote connection closed" > > Getting occasionally randomly: > Remote communication error. Target disconnected.: Connection reset by peer. > (gdb) FAIL: gdb.server/server-kill.exp: tstatus > > (it was FAILing on "step" before, "tstatus" vs. "step" does not matter) > > I even Googled one may get ECONNRESET by writing into a closed TCP socket: > http://stackoverflow.com/questions/2974021/what-does-econnreset-mean-in-the-context-of-an-af-local-socket > > But I was unable to reproduce it myself (kernel-3.8.4-202.fc18.x86_64) with > the attached testcase: > sleeping ... done > write ok > ssize=0 > read ok > send: send.c:53: main: Unexpected error: Broken pipe. > Aborted > by: > * nc -l 5000 > * ./send (starts sleeping) > * kill -9 `pidof ncat` (Fedora nc is ncat) > * # send resumes sleeping > > I get at most EPIPE but never ECONNRESET. send vs. write and recv vs. read > also make no difference there. >From that url: "Triggered when there's outstanding outgoing data that has not yet been written to the other side." ncat is recv'ing the data you send it, so the window that could trigger is quite small. I've attached a standalone (no ncat) reproducer that triggers it all the time for me. $ ./send sleeping ... closing ... done send: send.c:72: main: Unexpected error: Connection reset by peer. Aborted > With no answer I will check in this patch as this issue seems unrelated to the > problem, GDB still works properly even with ECONNRESET. I was just curious. Looks fine to me. -- Pedro Alves --------------060501060609010502010305 Content-Type: text/x-csrc; name="send.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="send.c" Content-length: 1725 #define _GNU_SOURCE 1 #include #include #include #include #include #include #include #include #define PORT 5000 int main (void) { struct sockaddr_in sockaddr; socklen_t tmp; int listen_fd, send_fd, recv_fd; char charbuf; ssize_t ssize; int i; setbuf (stdout, NULL); /* bind/listen. */ errno = 0; listen_fd = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); assert (listen_fd != -1); sockaddr.sin_family = PF_INET; sockaddr.sin_port = htons (PORT); sockaddr.sin_addr.s_addr = INADDR_ANY; if (bind (listen_fd, (struct sockaddr *) &sockaddr, sizeof (sockaddr)) || listen (listen_fd, 1)) perror ("Can't bind address"); /* Connect. */ send_fd = socket (PF_INET,SOCK_STREAM, 0); assert (send_fd != -1); memset (&sockaddr, 0, sizeof sockaddr); sockaddr.sin_family = AF_INET; sockaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); sockaddr.sin_port = htons (PORT); i = connect (send_fd, (struct sockaddr *) &sockaddr, sizeof (sockaddr)); assert (i == 0); /* Accept. */ tmp = sizeof (sockaddr); recv_fd = accept (listen_fd, (struct sockaddr *) &sockaddr, &tmp); assert (recv_fd != -1); /* Send. */ charbuf = 'a'; ssize = send (send_fd, &charbuf, 1, 0); assert (ssize == 1); /* Now that data has been queued, close the receiving end. */ fputs ("sleeping ...", stdout); sleep (1); fputs (" closing ...", stdout); close (recv_fd); sleep (1); puts (" done"); /* Try sending again. */ charbuf = 'b'; errno = 0; ssize = send (send_fd, &charbuf, 1, 0); assert_perror (errno); assert (ssize == 1); puts ("send ok"); return 0; } --------------060501060609010502010305--