From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Jan 15 22:40:10 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org 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 2DFA216A41F for ; Sun, 15 Jan 2006 22:40:10 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09EE843D62 for ; Sun, 15 Jan 2006 22:40:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k0FMe3pI034759 for ; Sun, 15 Jan 2006 22:40:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k0FMe3NW034758; Sun, 15 Jan 2006 22:40:03 GMT (envelope-from gnats) Resent-Date: Sun, 15 Jan 2006 22:40:03 GMT Resent-Message-Id: <200601152240.k0FMe3NW034758@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, Ben Goetter Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0BC4916A41F for ; Sun, 15 Jan 2006 22:35:14 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB0E243D45 for ; Sun, 15 Jan 2006 22:35:13 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k0FMZDl3058978 for ; Sun, 15 Jan 2006 22:35:13 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k0FMZDwa058977; Sun, 15 Jan 2006 22:35:13 GMT (envelope-from nobody) Message-Id: <200601152235.k0FMZDwa058977@www.freebsd.org> Date: Sun, 15 Jan 2006 22:35:13 GMT From: Ben Goetter To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: ports/91843: [patch] thttpd with USE_SENDFILE generates ENOTCONN noise in syslog X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2006 22:40:10 -0000 >Number: 91843 >Category: ports >Synopsis: [patch] thttpd with USE_SENDFILE generates ENOTCONN noise in syslog >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 15 22:40:03 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Ben Goetter >Release: FreeBSD 5.4-RELEASE-p8 >Organization: >Environment: FreeBSD bgkh-household.seattle.mazama.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 #1: Thu Dec 22 11:49:41 PST 2005 goetter@bgkh-household.seattle.mazama.net:/usr/obj/usr/src/sys/BGKH-HOUSEHOLD i386 >Description: sendfile(2) returns ENOTCONN when a client drops a connection. thttpd with USE_SENDFILE is syslogging every such drop. This generates a lot of spurious traffic in the log. thttpd already filters ECONNRESET returns from write/writev() as uninteresting. If USE_SENDFILE, it should likewise filter ENOTCONN returns. >How-To-Repeat: Let a spider (e.g. msnbot) crawl a directory containing a number of large application/octet-stream objects. Peruse the resulting log entries (/var/log/thttpd.log, console, ...) >Fix: See the last eight lines of the following diff: [goetter:/usr/ports/www/thttpd/work/thttpd-2.25b]$ diff thttpd.c.orig thttpd.c 1725a1726,1737 > #ifdef USE_SENDFILE > off_t sbytes; > > sz = sendfile( > hc->file_fd, hc->conn_fd, c->next_byte_index, > MIN( c->end_byte_index - c->next_byte_index, max_bytes ), > NULL, &sbytes, 0 ); > if (sz == -1 && errno == EAGAIN) > sz = sbytes > 0 ? sbytes : -1; > else if (sz == 0) > sz = sbytes; > #else 1728a1741 > #endif 1731a1745,1764 > #ifdef USE_SENDFILE > struct sf_hdtr sf; > struct iovec iv; > off_t sbytes; > > iv.iov_base = hc->response; > iv.iov_len = hc->responselen; > sf.headers = &iv; > sf.hdr_cnt = 1; > sf.trailers = NULL; > sf.trl_cnt = 0; > sz = sendfile( > hc->file_fd, hc->conn_fd, c->next_byte_index, > MIN( c->end_byte_index - c->next_byte_index, max_bytes ), > &sf, &sbytes, 0 ); > if (sz == -1 && errno == EAGAIN) > sz = sbytes > 0 ? sbytes : -1; > else if (sz == 0) > sz = sbytes; > #else 1741a1775 > #endif 1789c1823,1827 < if ( errno != EPIPE && errno != EINVAL && errno != ECONNRESET ) --- > if ( errno != EPIPE && errno != EINVAL && errno != ECONNRESET > #ifdef USE_SENDFILE > && errno != ENOTCONN > #endif > ) >Release-Note: >Audit-Trail: >Unformatted: