From nobody@FreeBSD.org  Sun Sep  2 13:36:51 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95025106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  2 Sep 2012 13:36:51 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 8050F8FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  2 Sep 2012 13:36:51 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q82Dapig020591
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 2 Sep 2012 13:36:51 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q82DapEE020590;
	Sun, 2 Sep 2012 13:36:51 GMT
	(envelope-from nobody)
Message-Id: <201209021336.q82DapEE020590@red.freebsd.org>
Date: Sun, 2 Sep 2012 13:36:51 GMT
From: Steven Lee <steven@roothosts.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: net-p2p/bitcoin suffers a spinlock problem (fix included)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         171252
>Category:       ports
>Synopsis:       net-p2p/bitcoin suffers a spinlock problem (fix included)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    swills
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 02 13:40:08 UTC 2012
>Closed-Date:    Tue Sep 04 20:47:15 UTC 2012
>Last-Modified:  Tue Sep  4 20:50:02 UTC 2012
>Originator:     Steven Lee
>Release:        9.0-RELEASE-p3
>Organization:
RootHosts, Inc.
>Environment:
FreeBSD devel1.roothosts.com.local 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #6: Sun Aug 26 05:38:45 MDT 2012     steven@devel1.roothosts.com.local:/sys/amd64/compile/DEVEL  amd64

>Description:
net-p2p/bitcoin seems to have the same spinlock problem as it does on OSX.

I think the bug is somewhere inside of boost, but I am unable to locate it.

>How-To-Repeat:
Install net-p2p/bitcoin (GUI or console version) and let it connect to the network. After ~20 minutes the process will consume 100% CPU and stay there even when the debug log indicates that the process isn't busy.
>Fix:
Found the fix in util.h. The bitcoin developers had included a fix for OSX that works on FreeBSD. Attached is a patch against the latest port to simply enable the fix.

Patch attached with submission follows:

--- work/bitcoin-bitcoin-6e0c5e3/src/util.h.orig	2012-09-02 08:13:29.000000000 -0500
+++ work/bitcoin-bitcoin-6e0c5e3/src/util.h	2012-09-02 08:14:08.000000000 -0500
@@ -290,8 +290,6 @@
         LeaveCritical(); \
     }
 
-#ifdef MAC_OSX
-// boost::interprocess::interprocess_semaphore seems to spinlock on OSX; prefer polling instead
 class CSemaphore
 {
 private:
@@ -328,9 +326,6 @@
         val++;
     }
 };
-#else
-typedef boost::interprocess::interprocess_semaphore CSemaphore;
-#endif
 
 inline std::string i64tostr(int64 n)
 {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->swills 
Responsible-Changed-By: swills 
Responsible-Changed-When: Tue Sep 4 19:58:58 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171252 
State-Changed-From-To: open->closed 
State-Changed-By: swills 
State-Changed-When: Tue Sep 4 20:47:12 UTC 2012 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171252 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/171252: commit references a PR
Date: Tue,  4 Sep 2012 20:47:07 +0000 (UTC)

 Author: swills
 Date: Tue Sep  4 20:46:54 2012
 New Revision: 303670
 URL: http://svn.freebsd.org/changeset/ports/303670
 
 Log:
   - Hopefully really fix the last high CPU usage case
   
   PR:		ports/171252
   Submitted by:	Steven Lee <steven@roothosts.com>
 
 Added:
   head/net-p2p/bitcoin/files/patch-util.h   (contents, props changed)
 Modified:
   head/net-p2p/bitcoin/Makefile
 
 Modified: head/net-p2p/bitcoin/Makefile
 ==============================================================================
 --- head/net-p2p/bitcoin/Makefile	Tue Sep  4 19:05:49 2012	(r303669)
 +++ head/net-p2p/bitcoin/Makefile	Tue Sep  4 20:46:54 2012	(r303670)
 @@ -7,7 +7,7 @@
  
  PORTNAME=	bitcoin
  PORTVERSION=	0.6.3
 -PORTREVISION=	2
 +PORTREVISION=	3
  CATEGORIES=	net-p2p finance
  
  MAINTAINER=	ports@FreeBSD.org
 
 Added: head/net-p2p/bitcoin/files/patch-util.h
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/net-p2p/bitcoin/files/patch-util.h	Tue Sep  4 20:46:54 2012	(r303670)
 @@ -0,0 +1,21 @@
 +--- src/util.h.orig	2012-09-02 08:13:29.000000000 -0500
 ++++ src/util.h	2012-09-02 08:14:08.000000000 -0500
 +@@ -290,8 +290,6 @@
 +         LeaveCritical(); \
 +     }
 + 
 +-#ifdef MAC_OSX
 +-// boost::interprocess::interprocess_semaphore seems to spinlock on OSX; prefer polling instead
 + class CSemaphore
 + {
 + private:
 +@@ -328,9 +326,6 @@
 +         val++;
 +     }
 + };
 +-#else
 +-typedef boost::interprocess::interprocess_semaphore CSemaphore;
 +-#endif
 + 
 + inline std::string i64tostr(int64 n)
 + {
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
