From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Apr 9 04:30:13 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6198106566B for ; Mon, 9 Apr 2012 04:30:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 932898FC15 for ; Mon, 9 Apr 2012 04:30:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q394UDOk037100 for ; Mon, 9 Apr 2012 04:30:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q394UDnm037099; Mon, 9 Apr 2012 04:30:13 GMT (envelope-from gnats) Resent-Date: Mon, 9 Apr 2012 04:30:13 GMT Resent-Message-Id: <201204090430.q394UDnm037099@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, Timothy Beyer Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B92E8106564A for ; Mon, 9 Apr 2012 04:29:17 +0000 (UTC) (envelope-from beyert@fastmail.fm) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 83A2C8FC0A for ; Mon, 9 Apr 2012 04:29:17 +0000 (UTC) Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id A5E9A2168E for ; Mon, 9 Apr 2012 00:29:11 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute3.internal (MEProxy); Mon, 09 Apr 2012 00:29:11 -0400 Received: from aeonserv.aeonnet.fastmail.fm (cpe-76-90-217-240.socal.res.rr.com [76.90.217.240]) by mail.messagingengine.com (Postfix) with ESMTPSA id D4131482630; Mon, 9 Apr 2012 00:29:10 -0400 (EDT) Message-Id: <87wr5pjzot.wl@fastmail.fm> Date: Sun, 08 Apr 2012 21:29:06 -0700 From: Timothy Beyer To: FreeBSD-gnats-submit@FreeBSD.org Cc: Timothy Beyer Subject: ports/166778: revise port: lang/urweb 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: Mon, 09 Apr 2012 04:30:13 -0000 >Number: 166778 >Category: ports >Synopsis: revise port: lang/urweb >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Mon Apr 09 04:30:13 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Timothy Beyer >Release: FreeBSD 9.0-RELEASE i386 >Organization: no organization >Environment: System: FreeBSD aeonserv.aeonnet 9.0-RELEASE FreeBSD 9.0-RELEASE #9: Fri Mar 9 00:02:30 PST 2012 root@aeonserv.aeonnet:/usr/obj/usr/src/sys/CUSTOM i386 >Description: According to the urweb developers, apparently my mutex initializer patch to files/urweb.c could potentially have deadlock issues. So, this is a more complete fix that does not have deadlock issues. Also, I got rid of files/patch-Makefile.am and files/patch-Makefile.in, since turning off -Werror is no longer required to compile. >How-To-Repeat: apply the patch and build >Fix: Apply the patch and build --- urweb.diff begins here --- Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -4,10 +4,11 @@ # # $FreeBSD: ports/lang/urweb/Makefile,v 1.1 2012/04/06 14:36:30 scheidell Exp $ PORTNAME= urweb PORTVERSION= 20120329 +PORTREVISION= 1 CATEGORIES= lang www MASTER_SITES= http://www.impredicative.com/ur/ EXTRACT_SUFX= .tgz MAINTAINER= beyert@cs.ucr.edu DELETED files/patch-Makefile.am Index: files/patch-Makefile.am ================================================================== --- files/patch-Makefile.am +++ files/patch-Makefile.am @@ -1,8 +0,0 @@ ---- src/c/Makefile.am.orig 2012-03-29 08:09:43.000000000 -0700 -+++ src/c/Makefile.am 2012-04-04 00:52:39.000000000 -0700 -@@ -7,4 +7,4 @@ - liburweb_static_la_SOURCES = static.c - - AM_CPPFLAGS = -I../../include @OPENSSL_INCLUDES@ --AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations -+AM_CFLAGS = -Wimplicit -Wall -Wno-format-security -Wno-deprecated-declarations DELETED files/patch-Makefile.in Index: files/patch-Makefile.in ================================================================== --- files/patch-Makefile.in +++ files/patch-Makefile.in @@ -1,11 +0,0 @@ ---- src/c/Makefile.in.orig 2012-03-29 08:09:43.000000000 -0700 -+++ src/c/Makefile.in 2012-04-04 00:52:43.000000000 -0700 -@@ -254,7 +254,7 @@ - liburweb_fastcgi_la_SOURCES = fastcgi.c - liburweb_static_la_SOURCES = static.c - AM_CPPFLAGS = -I../../include @OPENSSL_INCLUDES@ --AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations -+AM_CFLAGS = -Wimplicit -Wall -Wno-format-security -Wno-deprecated-declarations - all: all-am - - .SUFFIXES: Index: files/patch-urweb.c ================================================================== --- files/patch-urweb.c +++ files/patch-urweb.c @@ -1,16 +1,54 @@ ---- src/c/urweb.c.orig 2012-03-29 08:09:43.000000000 -0700 -+++ src/c/urweb.c 2012-04-04 00:55:17.000000000 -0700 -@@ -160,12 +160,7 @@ +--- src/c/urweb.c.orig Thu Mar 29 11:23:35 2012 -0400 ++++ src/c/urweb.c Sun Apr 08 13:47:57 2012 -0700 +@@ -159,13 +159,7 @@ + static client **clients, *clients_free, *clients_used; static unsigned n_clients; - static pthread_mutex_t clients_mutex = +-static pthread_mutex_t clients_mutex = - #ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER - PTHREAD_RECURSIVE_MUTEX_INITIALIZER - #else - PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - #endif - ; -+PTHREAD_MUTEX_INITIALIZER; ++static pthread_mutex_t clients_mutex = PTHREAD_MUTEX_INITIALIZER; size_t uw_messages_max = SIZE_MAX; size_t uw_clients_max = SIZE_MAX; +@@ -230,20 +224,23 @@ + } + + static const char begin_msgs[] = "Content-type: text/plain\r\n\r\n"; ++static pthread_t pruning_thread; ++static int pruning_thread_initialized = 0; + + static client *find_client(unsigned id) { + client *c; +- +- pthread_mutex_lock(&clients_mutex); ++ int i_am_pruner = pruning_thread_initialized && pthread_equal(pruning_thread, pthread_self()); ++ ++ if (!i_am_pruner) pthread_mutex_lock(&clients_mutex); + + if (id >= n_clients) { +- pthread_mutex_unlock(&clients_mutex); ++ if (!i_am_pruner) pthread_mutex_unlock(&clients_mutex); + return NULL; + } + + c = clients[id]; + +- pthread_mutex_unlock(&clients_mutex); ++ if (!i_am_pruner) pthread_mutex_unlock(&clients_mutex); + return c; + } + +@@ -3291,6 +3288,8 @@ + cutoff = time(NULL) - ctx->app->timeout; + + pthread_mutex_lock(&clients_mutex); ++ pruning_thread = pthread_self(); ++ pruning_thread_initialized = 1; + + for (c = clients_used; c; c = next) { + next = c->next; --- urweb.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: