From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12248 invoked by alias); 16 Apr 2009 15:12:41 -0000 Received: (qmail 12240 invoked by uid 22791); 16 Apr 2009 15:12:39 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Apr 2009 15:12:34 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 79BAC3B4005F for ; Thu, 16 Apr 2009 16:12:31 +0100 (BST) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3rBj+JP-53y3; Thu, 16 Apr 2009 16:12:30 +0100 (BST) From: bugzilla-daemon@ecoscentric.com To: ecos-bugs@ecos.sourceware.org Subject: [Bug 1000738] Redboot networking problem X-Bugzilla-Reason: QAcontact X-Bugzilla-Type: newchanged X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: RedBoot X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andrew.lunn@ascom.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: normal X-Bugzilla-Assigned-To: gary@mlbassoc.com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 16 Apr 2009 15:12:00 -0000 Message-Id: <20090416151230.19CE53B40048@mail.ecoscentric.com> Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org X-SW-Source: 2009/txt/msg00175.txt.bz2 http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000738 Andrew Lunn changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew.lunn@ascom.ch --- Comment #1 from Andrew Lunn 2009-04-16 16:12:27 --- There is a race condition with closing the socket and opening the next socket. The normal code path is: http_client.c opens the first socket and transfers data. Once finished it calls http_stream_close() which calls __tcp_abort(). __tcp_abort() starts a timer with a delay of 1ms. After that 1ms delay the function do_abort() is called which sends a TCP ACK and RST packet and then unlinks the socket structure from the linked list of sockets. The race happens because the socket structure is a member of the static singleton http_stream in http_client.c. What i think is happening is that after the http_stream_close(), you are starting a second http transfer, before the 1ms delay. This results in the http_stream->sock structure being added to the linked list for a "second time", messing up the list pointers, and so giving your endless loop. When you delay your next http transfer for a short while, bigger an 1ms, the socket gets removed from the list before it is added to the list and everybody is happy. How to solve this problem? _tcp_open has code like: // Send off the SYN packet to open the connection tcp_send(s, TCP_FLAG_SYN, 0); // Wait for connection to establish while (s->state != _ESTABLISHED) { if (s->state == _CLOSED) { diag_printf("TCP open - host closed connection\n"); return -1; } if (--timeout <= 0) { diag_printf("TCP open - connection timed out\n"); return -1; } MS_TICKS_DELAY(); __tcp_poll(); } return 0; Maybe abort needs something similar: void __tcp_abort(tcp_socket_t *s, unsigned long delay) { int timeout = 10; __timer_set(&abort_timer, delay, do_abort, s); while (s->state != _CLOSED) { if (--timeout <= 0) { diag_printf("TCP close - connection failed to close\n"); return; } MS_TICKS_DELAY(); __tcp_poll(); } } It also looks like there could be a second similar race condition when the connection breaks. The code calls __tcp_close(&s->sock) and returns. Maybe a call to __tcp_close_wait() is needed? -- Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.