From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Oct 25 04:40:09 2003 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1274A16A4BF for ; Sat, 25 Oct 2003 04:40:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC82F43FD7 for ; Sat, 25 Oct 2003 04:40:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h9PBe6FY061128 for ; Sat, 25 Oct 2003 04:40:06 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h9PBe6HC061127; Sat, 25 Oct 2003 04:40:06 -0700 (PDT) (envelope-from gnats) Resent-Date: Sat, 25 Oct 2003 04:40:06 -0700 (PDT) Resent-Message-Id: <200310251140.h9PBe6HC061127@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vladimir Ivanov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DBFD316A4B3 for ; Sat, 25 Oct 2003 04:35:38 -0700 (PDT) Received: from cmail.yandex.ru (cmail.yandex.ru [213.180.193.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B18C43F85 for ; Sat, 25 Oct 2003 04:35:37 -0700 (PDT) (envelope-from wawa@wawa.yandex.ru) Received: from wawa.yandex.ru (wawa.yandex.ru [213.180.193.150]) by cmail.yandex.ru (8.12.9/8.12.9) with ESMTP id h9PBZZhI051063 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 25 Oct 2003 15:35:35 +0400 (MSD) (envelope-from wawa@wawa.yandex.ru) Received: from wawa.yandex.ru (localhost [127.0.0.1]) by wawa.yandex.ru (8.12.9p2/8.12.9) with ESMTP id h9PBZVSq062414 for ; Sat, 25 Oct 2003 15:35:32 +0400 (MSD) (envelope-from wawa@wawa.yandex.ru) Received: (from wawa@localhost) by wawa.yandex.ru (8.12.9p2/8.12.9/Submit) id h9PBZU4P062413; Sat, 25 Oct 2003 15:35:30 +0400 (MSD) (envelope-from wawa) Message-Id: <200310251135.h9PBZU4P062413@wawa.yandex.ru> Date: Sat, 25 Oct 2003 15:35:30 +0400 (MSD) From: Vladimir Ivanov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/58514: Zebra based software BGP routers may freeze after a small network disturbance X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Vladimir Ivanov List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2003 11:40:09 -0000 >Number: 58514 >Category: ports >Synopsis: Zebra based software BGP routers may freeze after a small network disturbance >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 25 04:40:01 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Vladimir Ivanov >Release: >Organization: Yandex LLC >Environment: System: FreeBSD wawa.yandex.ru 4.9-RC FreeBSD 4.9-RC #1: Wed Oct 22 09:28:23 MSD 2003 wawa@wawa.yandex.ru:/usr/obj/usr/src/sys/WAWA i386 >Description: Sometimes Zebra (BGPD) software router freeze. After short investigations we've discovered blocked write operation in the BGP code (see the patch below). It's a little bit funny because a couple lines before we can see authors comments which promissed non-blocking write operation. Alternate releases of Zebra (aka gnuzebra or quagga) contain the same bug I seem. >How-To-Repeat: The problem occured when two Zebra routers being used to share network traffic. Both routers sould be bgp neighbours. Then we have to force both Zebras to fill network sendbuffers of session to each other. It's not very hard task I guess. In freeze situation each Zebra waits when other one will read packet and that's why it doesn read packet as we can see. >Fix: --- bgpd/bgp_packet.c Tue Aug 20 19:31:54 2002 +++ bgpd/bgp_packet.c Thu Oct 16 19:33:14 2003 @@ -566,17 +566,22 @@ while (1) { int writenum; + int val; s = bgp_write_packet (peer); if (! s) return 0; + val = fcntl (peer->fd, F_GETFL, 0); + fcntl (peer->fd, F_SETFL, val|O_NONBLOCK); + /* Number of bytes to be sent. */ writenum = stream_get_endp (s) - stream_get_getp (s); /* Call write() system call. */ num = write (peer->fd, STREAM_PNT (s), writenum); write_errno = errno; + fcntl (peer->fd, F_SETFL, val); if (num <= 0) { /* Partial write. */ >Release-Note: >Audit-Trail: >Unformatted: