NetBSD Problem Report #49851

From www@NetBSD.org  Fri Apr 24 10:16:34 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2B6A0A57FD
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 24 Apr 2015 10:16:34 +0000 (UTC)
Message-Id: <20150424101632.3DA04A6562@mollari.NetBSD.org>
Date: Fri, 24 Apr 2015 10:16:32 +0000 (UTC)
From: german@free.fr
Reply-To: german@free.fr
To: gnats-bugs@NetBSD.org
Subject: gtk-gnutella is outdated
X-Send-Pr-Version: www-1.0

>Number:         49851
>Category:       pkg
>Synopsis:       gtk-gnutella is outdated
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    adam
>State:          closed
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 24 10:20:00 +0000 2015
>Closed-Date:    Tue Mar 07 19:39:12 +0000 2023
>Last-Modified:  Tue Mar 07 19:39:12 +0000 2023
>Originator:     Germain Le Chapelain
>Release:        HEAD
>Organization:
cgn
>Environment:
NetBSD germ 7.99.6 NetBSD 7.99.6 (GENERIC) #0: Sat Mar 28 21:51:45 UTC 2015  german@germ:/usr/obj/sys/arch/amd64/compile/GENERIC amd64

>Description:
gtk-gnutella has been updated (to version 1.1.3)

I am trying to get it going, but I'am having a problem with PTHREAD_STACK_MIN, which is not defined for us ?

I've tried replacing it with sysconf(_SC_THREAD_STACK_MIN) as I saw in http://mail-index.netbsd.org/tech-userlevel/2014/08/15/msg008729.html

but now gtk-gnutella isn't going.


When I look in `top' I see it at the bottom of the screen, it says:

 1303 root      85    0    13M  852K kqueue/3   0:00  0.00%  0.00% powerd
29978 german    43    0   126M 9276K parked/3   0:00  0.00%  0.00% gtk-gnutella

>How-To-Repeat:
Try building gtk-gnutella with the enclosed patches

The change to the Makefile, PLIST & distinfo I use to build are the following:


-bash-4.3$ cvs diff -ub Makefile PLIST distinfo
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/net/gtk-gnutella/Makefile,v
retrieving revision 1.88
diff -u -b -r1.88 Makefile
--- Makefile    21 Aug 2014 09:48:30 -0000      1.88
+++ Makefile    23 Apr 2015 18:51:23 -0000
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.88 2014/08/21 09:48:30 jperkin Exp $

-DISTNAME=      gtk-gnutella-0.96.6
+DISTNAME=      gtk-gnutella-1.1.3
 PKGREVISION=   22
 CATEGORIES=    net
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=gtk-gnutella/}
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/net/gtk-gnutella/PLIST,v
retrieving revision 1.16
diff -u -b -r1.16 PLIST
--- PLIST       14 Jun 2009 18:09:29 -0000      1.16
+++ PLIST       23 Apr 2015 18:51:23 -0000
@@ -1,11 +1,16 @@
-@comment $NetBSD: PLIST,v 1.16 2009/06/14 18:09:29 joerg Exp $
+@comment $NetBSD$
 bin/gtk-gnutella
+lib/gtk-gnutella/gtk-gnutella.nm
+share/appdata/gtk-gnutella.appdata.xml
 share/applications/gtk-gnutella.desktop
 share/gtk-gnutella/bogons.txt
 share/gtk-gnutella/el/FAQ
 share/gtk-gnutella/en/FAQ
 share/gtk-gnutella/favicon.png
+share/gtk-gnutella/fr/FAQ
 share/gtk-gnutella/geo-ip.txt
+share/gtk-gnutella/geo-ipv6.txt
+share/gtk-gnutella/gwcache.boot
 share/gtk-gnutella/hostiles.txt
 share/gtk-gnutella/ja/FAQ
 share/gtk-gnutella/pixmaps/arrow_down.xpm
@@ -28,26 +33,39 @@
 share/gtk-gnutella/pixmaps/firewall_udp_punchable.xpm
 share/gtk-gnutella/pixmaps/freeze.xpm
 share/gtk-gnutella/pixmaps/icon.16x16.xpm
-share/gtk-gnutella/pixmaps/icon.32x32.xpm
+share/gtk-gnutella/pixmaps/icon.48x48.xpm
 share/gtk-gnutella/pixmaps/icon.xpm
 share/gtk-gnutella/pixmaps/leaf.xpm
 share/gtk-gnutella/pixmaps/legacy.xpm
 share/gtk-gnutella/pixmaps/magnet.16x16.png
 share/gtk-gnutella/pixmaps/magnet.32x32.png
 share/gtk-gnutella/pixmaps/magnet.64x64.png
+share/gtk-gnutella/pixmaps/natpmp.xpm
 share/gtk-gnutella/pixmaps/no_firewall.xpm
 share/gtk-gnutella/pixmaps/offline.xpm
 share/gtk-gnutella/pixmaps/online.xpm
+share/gtk-gnutella/pixmaps/pause.xpm
 share/gtk-gnutella/pixmaps/save.xpm
 share/gtk-gnutella/pixmaps/smallserver.xpm
+share/gtk-gnutella/pixmaps/star-black.xpm
+share/gtk-gnutella/pixmaps/star-blue.xpm
+share/gtk-gnutella/pixmaps/star-green.xpm
+share/gtk-gnutella/pixmaps/star-red.xpm
+share/gtk-gnutella/pixmaps/star-violet.xpm
+share/gtk-gnutella/pixmaps/star-yellow.xpm
 share/gtk-gnutella/pixmaps/stock_form-time-field-16.xpm
 share/gtk-gnutella/pixmaps/thaw.xpm
 share/gtk-gnutella/pixmaps/ultra.xpm
+share/gtk-gnutella/pixmaps/upload-red.xpm
+share/gtk-gnutella/pixmaps/upload-yellow.xpm
 share/gtk-gnutella/pixmaps/upload.xpm
+share/gtk-gnutella/pixmaps/upnp-unusable.xpm
+share/gtk-gnutella/pixmaps/upnp.xpm
 share/gtk-gnutella/pixmaps/warning.xpm
 share/gtk-gnutella/robots.txt
 share/gtk-gnutella/spam.txt
 share/gtk-gnutella/spam_sha1.txt
+share/gtk-gnutella/tr/FAQ
 share/locale/de/LC_MESSAGES/gtk-gnutella.mo
 share/locale/el/LC_MESSAGES/gtk-gnutella.mo
 share/locale/es/LC_MESSAGES/gtk-gnutella.mo
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/net/gtk-gnutella/distinfo,v
retrieving revision 1.30
diff -u -b -r1.30 distinfo
--- distinfo    14 Jul 2009 09:41:31 -0000      1.30
+++ distinfo    23 Apr 2015 18:51:23 -0000
@@ -1,7 +1,9 @@
 $NetBSD: distinfo,v 1.30 2009/07/14 09:41:31 hasso Exp $

-SHA1 (gtk-gnutella-0.96.6.tar.bz2) = 319417e8de104b33913e08a0aaec8c0f22a6129d
-RMD160 (gtk-gnutella-0.96.6.tar.bz2) = 0dae6af9ac64fa8d75980cafd55c5a3e9eb18dfe
-Size (gtk-gnutella-0.96.6.tar.bz2) = 15739240 bytes
-SHA1 (patch-aa) = 0df2e52177c1601b0533862a841ef61b2ac440ca
-SHA1 (patch-ab) = 45d59a62acbfa38a952cf31e8ceecacc9c90f077
+SHA1 (gtk-gnutella-1.1.3.tar.bz2) = f3e6e5e336a7728038a444b419f3de1d1478b257
+RMD160 (gtk-gnutella-1.1.3.tar.bz2) = 108e2dbf43d0d4641ca4ac5591a0aad5fe20f7f6
+Size (gtk-gnutella-1.1.3.tar.bz2) = 19504243 bytes
+SHA1 (patch-entropy.c) = e4b37c5d2e7056bf334abfd3eb22d14474a412cc
+SHA1 (patch-pow2.h) = ae4de22d8f9360bec3e215932744927b9a30e86f
+SHA1 (patch-rand31.c) = 3b67b8999e51c58c4566af05d67c1682b424594f
+SHA1 (patch-thread.c) = 248e2b40457afcaca6e71dcb347c029b42db6def
-bash-4.3$

>Fix:
--- patch-thread.c begins here ---
$NetBSD$

--- src/lib/thread.c.orig       2014-09-02 06:45:46.000000000 +0000
+++ src/lib/thread.c
@@ -6934,7 +6934,7 @@ thread_launch(struct thread_element *te,
 #endif
                stacksize = MAX(stacksize, THREAD_STACK_MIN);
        } else {
-               stacksize = MAX(THREAD_STACK_DFLT, PTHREAD_STACK_MIN);
+               stacksize = MAX(THREAD--- patch-rand31.c begins here ---
$NetBSD$

--- src/lib/rand31.c.orig       2014-09-02 06:45:46.000000000 +0000
+++ src/lib/rand31.c
@@ -146,7 +146,7 @@ rand31_random_seed(void)
        nsecs += now.tv_nsec;
        entropy_delay();
        tm_precise_time(&now);
-       seed = UINT32_ROTL(seed, popcount(nsecs + now.tv_nsec));
+       seed = UINT32_ROTL(seed, popcount_(nsecs + now.tv_nsec));
        while (0 != discard--) {                seed = rand31_prng_next(seed);
        }
--- patch-rand31.c ends here ---
_STACK_DFLT, sysconf(_SC_THREAD_STACK_MIN));
        }

        stacksize = round_pagesize(stacksize);  /* In case they supply odd values */
--- patch-thread.c ends here ---
--- patch-entropy.c begins here ---
$NetBSD$

--- src/lib/entropy.c.orig      2014-09-02 06:45:46.000000000 +0000
+++ src/lib/entropy.c
@@ -1136,7 +1136,7 @@ entropy_seed(struct entropy_minictx *c)
        tm_precise_time(&now);          /* Do not use tm_now_exact(), it's too soon */
        SHA1_INPUT(&ctx, now);

-       j = popcount(now.tv_nsec);
+       j = popcount_(now.tv_nsec);
        for (i = 0; i <= j; i++) {
                ENTROPY_CONTEXT_FEED;                                                                           \
        }
@@ -1208,7 +1208,7 @@ entropy_seed(struct entropy_minictx *c)
        SHA1_INPUT(&ctx, now);

        tm_precise_time(&now);
-       j = popcount(now.tv_nsec * 11);
+       j = popcount_(now.tv_nsec * 11);
        for (i = 0; i <= j; i++) {
                ENTROPY_CONTEXT_FEED;
        }
@@ -1225,7 +1225,7 @@ entropy_seed(struct entropy_minictx *c)

                entropy_delay();
                tm_precise_time(&now);
-               n = popcount(peek_be32(p) + now.tv_nsec);
+               n = popcount_(peek_be32(p) + now.tv_nsec);
                j = UINT32_ROTR(v, n) & 0xff;
                for (i = 0; i <= j; i++) {
                ENTROPY_CONTEXT_FEED;
        }
@@ -1225,7 +1225,7 @@ entropy_seed(struct entropy_minictx *c)

                entropy_delay();
                tm_precise_time(&now);
-               n = popcount(peek_be32(p) + now.tv_nsec);
+               n = popcount_(peek_be32(p) + now.tv_nsec);
                j = UINT32_ROTR(v, n) & 0xff;
                for (i = 0; i <= j; i++) {
                        ENTROPY_CONTEXT_FEED;
--- patch-entropy.c ends here ---
--- patch-pow2.h begins here ---
$NetBSD$

--- src/lib/pow2.h.orig 2014-09-02 06:45:46.000000000 +0000
+++ src/lib/pow2.h
@@ -67,7 +67,7 @@ is_pow2(uint32 value)
  * @return number of 1 bits in a 32-bit integer.
  */
 static inline ALWAYS_INLINE G_GNUC_CONST int
-popcount(uint32 x)
+popcount_(uint32 x)
 #ifdef HAS_BUILTIN_POPCOUNT
 {
        return __builtin_popcount(x);
@@ -153,7 +153,7 @@ clz(uint32 x)
        x |= x >> 4;
        x |= x >> 8;
        x |= x >> 16;
-       return 32 - popcount(x);
+       return 32 - popcount_(x);
 }
 #endif /* HAS_BUILTIN_CLZ */

@@ -176,7 +176,7 @@ int bits_set(uint8 b) G_GNUC_PURE;
 static inline ALWAYS_INLINE G_GNUC_CONST int
 bits_set32(uint32 v)
 {
-       return popcount(v);
+       return popcount_(v);
 }

 #endif /* _pow2_h_ */
--- patch-pow2.h ends here ---

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->adam
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Sun, 28 Jun 2015 15:08:09 +0000
Responsible-Changed-Why:
Over to maintainer.


From: Germain Le Chapelain <german@free.fr>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/49851
Date: Wed, 30 Sep 2015 21:03:09 +0000

 Now gtk-gnutella is rocking the version 1.1.4.

 I am still getting the same problem though :/


 I tried another patch (inspired directly by another page on the Internet) :


 $NetBSD$

 --- src/lib/thread.h.orig	2015-09-19 13:34:15.000000000 +0000
 +++ src/lib/thread.h
 @@ -36,6 +36,10 @@

  #include "tsig.h"		/* For tsigset_t */

 +#ifndef PTHREAD_STACK_MIN
 +#define PTHREAD_STACK_MIN 65536
 +#endif
 +
  /**
   * Main entry point for thread_create().
   */


 Exact same results :(


 I guess I will take a look what changed around the lines referring to a 
 PTHREAD STACK MIN between the working revision of gtk-gnutella in CVS and this one, 
 as well as litter the code base with breakpoints to try to understand how & when 
 the main window even open and why it doesn't for me now.


 Germain

 -- 
 Germain
 http://german.free.fr

From: Germain Le Chapelain <german@free.fr>
To: gnats-bugs@NetBSD.org
Cc: adam@NetBSD.org,  gnats-admin@netbsd.org,  pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Wed, 14 Oct 2015 16:08:06 +0000

 so I tried once more with the version 1.1.5

 This one compiles without any patches,


 it still gets into that `parked' state:

 -bash-4.3$ gtk-gnutella
 15-10-14 15:08:36.220 (WARNING): could not auto-tune stacktrace offsets, using d


 When I attach GDB to it, I see the following call stack right away (no need to stop.)


 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 #2  0x00007f7fef807dbc in ?? () from /usr/lib/libpthread.so.1
 #3  0x00007f7fef4ae271 in __locatime50 () from /usr/lib/libc.so.12
 #4  0x00000000005ecc39 in log_handler (domain=domain@entry=0x0, 
     level=level@entry=G_LOG_LEVEL_WARNING, 
     message=0x7f7ff7f98cf8 "getgateway(): route socket failed, using the netstat command", unused_data=unused_data@entry=0x0) at log.c:1994
 #5  0x00000000005d4a8a in gl_logv (domain=0x0, flags=G_LOG_LEVEL_WARNING, 
     fmt=<optimized out>, args=args@entry=0x7f7ff7fa4608) at glog.c:85
 #6  0x00000000005d4b73 in gl_log (domain=domain@entry=0x0, 
     flags=flags@entry=G_LOG_LEVEL_WARNING, 
     format=format@entry=0x775f30 "%s(): route socket failed, using the netstat command") at glog.c:100
 #7  0x000000000069a5f7 in getgateway (addrp=addrp@entry=0x7f7ff7fa4a40)
     at getgateway.c:400
 #8  0x00000000005c90f8 in entropy_collect_gateway (ctx=0x7f7ff7fa4ad0)
     at entropy.c:992
 #9  0x00000000006995ec in entropy_array_cb_collect (len=26, 
     ary=0x7f7ff7fa4b40, ctx=0x7f7ff7fa4ad0) at entropy.c:366
 #10 entropy_collect_internal (digest=digest@entry=0x7f7ff7fa4ca0, 
     can_malloc=can_malloc@entry=1, slow=1) at entropy.c:1167
 #11 0x0000000000699793 in entropy_do_collect (digest=0x7f7ff7fa4ca0)
     at entropy.c:1476
 #12 0x00000000005c96f7 in entropy_do_fill (buffer=0xb2ca90 <aje_state+16>, 
     len=16) at entropy.c:1574
 #13 0x00000000005b441d in aje_init (as=as@entry=0xb2ca80 <aje_state>)
     at aje.c:693
 #14 0x00000000005b44c3 in aje_default_init () at aje.c:729
 #15 0x000000000069c681 in once_flag_run_internal (
     flag=flag@entry=0xb2ca64 <aje_initialized>, 
     routine=routine@entry=0x5b44b5 <aje_default_init>, 
     recursive=recursive@entry=0) at once.c:144
 #16 0x00000000005f5ce8 in once_flag_run_internal (recursive=0, 
     routine=routine@entry=0x5b44b5 <aje_default_init>, 
     flag=flag@entry=0xb2ca64 <aje_initialized>) at once.c:169
 #17 once_flag_run (flag=flag@entry=0xb2ca64 <aje_initialized>, 
     routine=routine@entry=0x5b44b5 <aje_default_init>) at once.c:170
 #18 0x00000000005b48d3 in aje_addrandom (src=src@entry=0xb38080 <data>, 
     len=len@entry=256) at aje.c:749
 #19 0x0000000000603069 in random_add (data=data@entry=0xb38080 <data>, 
     datalen=datalen@entry=256) at random.c:1067
 #20 0x000000000060316b in random_add_pool (len=2, buf=0x7f7ff7fa4ece)
     at random.c:735
 #21 random_pool_append (buf=buf@entry=0x7f7ff7fa4eee, len=len@entry=2)
     at random.c:838
 #22 0x00000000005c9a51 in entropy_harvest_time () at entropy.c:1726
 #23 0x00000000005bec7b in cq_run_idle (cq=0x7f7ff7fb4000) at cq.c:1885
 #24 0x00000000005bfa48 in cq_idle (cq=<optimized out>) at cq.c:1307
 #25 0x00000000005ccd75 in evq_thread_main (unused_arg=unused_arg@entry=0x0)
     at evq.c:205
 #26 0x000000000062c252 in thread_launch_trampoline (arg=0x7f7ff7fb9020)
     at thread.c:7482
 #27 0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #28 0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #29 0x0000000000aae770 in prngs ()
 #30 0x000000000078d018 in assertion_data_.16534 ()
 #31 0x00000000000002d2 in ?? ()
 #32 0x00007f7ff7fb1108 in ?? ()


 So it's really locked onto here then ?


 	now = tv.tv_sec;
   =>	ct = localtime(&now);

 	prefix = log_prefix(level);


 Is there a problem calling localtime from within a thread ?

 or from a handler or something ?



 -- 
 Germain
 http://german.free.fr

From: christos@zoulas.com (Christos Zoulas)
To: Germain Le Chapelain <german@free.fr>, gnats-bugs@NetBSD.org
Cc: adam@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Wed, 14 Oct 2015 20:41:49 -0400

 On Oct 14,  4:08pm, german@free.fr (Germain Le Chapelain) wrote:
 -- Subject: Re: pkg/49851

 | 
 | so I tried once more with the version 1.1.5
 | 
 | This one compiles without any patches,
 | 
 | 
 | it still gets into that `parked' state:
 | 
 | -bash-4.3$ gtk-gnutella
 | 15-10-14 15:08:36.220 (WARNING): could not auto-tune stacktrace offsets, using d
 | 
 | 
 | When I attach GDB to it, I see the following call stack right away (no need to stop.)
 | 
 | 
 | #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 | #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 | #2  0x00007f7fef807dbc in ?? () from /usr/lib/libpthread.so.1
 | #3  0x00007f7fef4ae271 in __locatime50 () from /usr/lib/libc.so.12
 | #4  0x00000000005ecc39 in log_handler (domain=domain@entry=0x0, 
 |     level=level@entry=G_LOG_LEVEL_WARNING, 
 |     message=0x7f7ff7f98cf8 "getgateway(): route socket failed, using the netstat command", unused_data=unused_data@entry=0x0) at log.c:1994
 | #5  0x00000000005d4a8a in gl_logv (domain=0x0, flags=G_LOG_LEVEL_WARNING, 
 |     fmt=<optimized out>, args=args@entry=0x7f7ff7fa4608) at glog.c:85
 | #6  0x00000000005d4b73 in gl_log (domain=domain@entry=0x0, 
 |     flags=flags@entry=G_LOG_LEVEL_WARNING, 
 |     format=format@entry=0x775f30 "%s(): route socket failed, using the netstat command") at glog.c:100
 | #7  0x000000000069a5f7 in getgateway (addrp=addrp@entry=0x7f7ff7fa4a40)
 |     at getgateway.c:400
 | #8  0x00000000005c90f8 in entropy_collect_gateway (ctx=0x7f7ff7fa4ad0)
 |     at entropy.c:992
 | #9  0x00000000006995ec in entropy_array_cb_collect (len=26, 
 |     ary=0x7f7ff7fa4b40, ctx=0x7f7ff7fa4ad0) at entropy.c:366
 | #10 entropy_collect_internal (digest=digest@entry=0x7f7ff7fa4ca0, 
 |     can_malloc=can_malloc@entry=1, slow=1) at entropy.c:1167
 | #11 0x0000000000699793 in entropy_do_collect (digest=0x7f7ff7fa4ca0)
 |     at entropy.c:1476
 | #12 0x00000000005c96f7 in entropy_do_fill (buffer=0xb2ca90 <aje_state+16>, 
 |     len=16) at entropy.c:1574
 | #13 0x00000000005b441d in aje_init (as=as@entry=0xb2ca80 <aje_state>)
 |     at aje.c:693
 | #14 0x00000000005b44c3 in aje_default_init () at aje.c:729
 | #15 0x000000000069c681 in once_flag_run_internal (
 |     flag=flag@entry=0xb2ca64 <aje_initialized>, 
 |     routine=routine@entry=0x5b44b5 <aje_default_init>, 
 |     recursive=recursive@entry=0) at once.c:144
 | #16 0x00000000005f5ce8 in once_flag_run_internal (recursive=0, 
 |     routine=routine@entry=0x5b44b5 <aje_default_init>, 
 |     flag=flag@entry=0xb2ca64 <aje_initialized>) at once.c:169
 | #17 once_flag_run (flag=flag@entry=0xb2ca64 <aje_initialized>, 
 |     routine=routine@entry=0x5b44b5 <aje_default_init>) at once.c:170
 | #18 0x00000000005b48d3 in aje_addrandom (src=src@entry=0xb38080 <data>, 
 |     len=len@entry=256) at aje.c:749
 | #19 0x0000000000603069 in random_add (data=data@entry=0xb38080 <data>, 
 |     datalen=datalen@entry=256) at random.c:1067
 | #20 0x000000000060316b in random_add_pool (len=2, buf=0x7f7ff7fa4ece)
 |     at random.c:735
 | #21 random_pool_append (buf=buf@entry=0x7f7ff7fa4eee, len=len@entry=2)
 |     at random.c:838
 | #22 0x00000000005c9a51 in entropy_harvest_time () at entropy.c:1726
 | #23 0x00000000005bec7b in cq_run_idle (cq=0x7f7ff7fb4000) at cq.c:1885
 | #24 0x00000000005bfa48 in cq_idle (cq=<optimized out>) at cq.c:1307
 | #25 0x00000000005ccd75 in evq_thread_main (unused_arg=unused_arg@entry=0x0)
 |     at evq.c:205
 | #26 0x000000000062c252 in thread_launch_trampoline (arg=0x7f7ff7fb9020)
 |     at thread.c:7482
 | #27 0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 | #28 0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 | #29 0x0000000000aae770 in prngs ()
 | #30 0x000000000078d018 in assertion_data_.16534 ()
 | #31 0x00000000000002d2 in ?? ()
 | #32 0x00007f7ff7fb1108 in ?? ()
 | 
 | 
 | So it's really locked onto here then ?
 | 
 | 
 | 	now = tv.tv_sec;
 |   =>	ct = localtime(&now);
 | 
 | 	prefix = log_prefix(level);
 | 
 | 
 | Is there a problem calling localtime from within a thread ?
 | 
 | or from a handler or something ?

 localtime() is not async-signal-safe...

 http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
 Please install the debugging symbol libraries for the base system or build with
 MKDEBUG=yes.

 christos

From: Germain Le Chapelain <german@free.fr>
To: christos@zoulas.com (Christos Zoulas)
Cc: gnats-bugs@NetBSD.org,  adam@NetBSD.org,  gnats-admin@netbsd.org,
	  pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Wed, 21 Oct 2015 01:14:23 +0000

 christos@zoulas.com (Christos Zoulas) writes:

 > On Oct 14,  4:08pm, german@free.fr (Germain Le Chapelain) wrote:
 >
 > | Is there a problem calling localtime from within a thread ?
 > | 
 > | or from a handler or something ?
 >
 > localtime() is not async-signal-safe...
 >
 > http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
 > Please install the debugging symbol libraries for the base system or build with
 > MKDEBUG=yes.

 Thanks !


 I deleted the offending lines.

 Now I get similar results with getaddrinfo()


 [Switching to LWP 1]
 0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 (gdb) bt
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 #2  0x00007f7fef807f43 in ?? () from /usr/lib/libpthread.so.1
 #3  0x00007f7fef4f31b3 in nsdispatch () from /usr/lib/libc.so.12
 #4  0x00007f7fef4db0ea in getaddrinfo () from /usr/lib/libc.so.12
 #5  0x00000000005e0761 in resolve_hostname (net=NET_TYPE_NONE, 
     host=0x7f7ff7efa0d0 "germ") at host_addr.c:1315
 #6  name_to_host_addr (host=host@entry=0x7f7ff7efa0d0 "germ", 
     net=net@entry=NET_TYPE_NONE) at host_addr.c:1456
 #7  0x00000000005c9042 in entropy_collect_host (ctx=0x7f7ff7fa4ad0)
     at entropy.c:1012
 #8  0x000000000069952c in entropy_array_cb_collect (len=26, 
     ary=0x7f7ff7fa4b40, ctx=0x7f7ff7fa4ad0) at entropy.c:366
 #9  entropy_collect_internal (digest=digest@entry=0x7f7ff7fa4ca0, 
     can_malloc=can_malloc@entry=1, slow=1) at entropy.c:1167
 #10 0x00000000006996d3 in entropy_do_collect (digest=0x7f7ff7fa4ca0)
     at entropy.c:1476
 #11 0x00000000005c96f7 in entropy_do_fill (buffer=0xb2ca90 <aje_state+16>, 
     len=16) at entropy.c:1574
 #12 0x00000000005b441d in aje_init (as=as@entry=0xb2ca80 <aje_state>)
     at aje.c:693
 #13 0x00000000005b44c3 in aje_default_init () at aje.c:729
 #14 0x000000000069c5c1 in once_flag_run_internal (
     flag=flag@entry=0xb2ca64 <aje_initialized>, 
     routine=routine@entry=0x5b44b5 <aje_default_init>, 
     recursive=recursive@entry=0) at once.c:144
 #15 0x00000000005f5c28 in once_flag_run_internal (recursive=0, 
     routine=routine@entry=0x5b44b5 <aje_default_init>, 
     flag=flag@entry=0xb2ca64 <aje_initialized>) at once.c:169
 #16 once_flag_run (flag=flag@entry=0xb2ca64 <aje_initialized>, 
     routine=routine@entry=0x5b44b5 <aje_default_init>) at once.c:170
 #17 0x00000000005b48d3 in aje_addrandom (src=src@entry=0xb38080 <data>, 
     len=len@entry=256) at aje.c:749
 #18 0x0000000000602fa9 in random_add (data=data@entry=0xb38080 <data>, 
     datalen=datalen@entry=256) at random.c:1067
 #19 0x00000000006030ab in random_add_pool (len=2, buf=0x7f7ff7fa4ece)
     at random.c:735
 #20 random_pool_append (buf=buf@entry=0x7f7ff7fa4eee, len=len@entry=2)
     at random.c:838
 #21 0x00000000005c9a51 in entropy_harvest_time () at entropy.c:1726
 #22 0x00000000005bec7b in cq_run_idle (cq=0x7f7ff7fb4000) at cq.c:1885
 #23 0x00000000005bfa48 in cq_idle (cq=<optimized out>) at cq.c:1307
 #24 0x00000000005ccd75 in evq_thread_main (unused_arg=unused_arg@entry=0x0)
     at evq.c:205
 #25 0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb9020)
     at thread.c:7482
 #26 0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1


 One other thing too:  my getaddrinfo wasn't able to find "germ",
 the name returned by calls to `hostname'.

 I added it to my /etc/hosts and it seemed to do the trick,
 however gtk-gnutella still hangs :(


 Germain

 -- 
 Germain
 http://german.free.fr

From: christos@zoulas.com (Christos Zoulas)
To: Germain Le Chapelain <german@free.fr>
Cc: gnats-bugs@NetBSD.org, adam@NetBSD.org, gnats-admin@netbsd.org, 
	pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Wed, 21 Oct 2015 07:57:03 -0400

 On Oct 21,  1:14am, german@free.fr (Germain Le Chapelain) wrote:
 -- Subject: Re: pkg/49851

 | christos@zoulas.com (Christos Zoulas) writes:
 | 
 | > On Oct 14,  4:08pm, german@free.fr (Germain Le Chapelain) wrote:
 | >
 | > | Is there a problem calling localtime from within a thread ?
 | > | 
 | > | or from a handler or something ?
 | >
 | > localtime() is not async-signal-safe...
 | >
 | > http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
 | > Please install the debugging symbol libraries for the base system or build with
 | > MKDEBUG=yes.
 | 
 | Thanks !
 | 
 | 
 | I deleted the offending lines.
 | 
 | Now I get similar results with getaddrinfo()
 | 
 | 
 | [Switching to LWP 1]
 | 0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 | (gdb) bt
 | #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 | #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 | #2  0x00007f7fef807f43 in ?? () from /usr/lib/libpthread.so.1
 | #3  0x00007f7fef4f31b3 in nsdispatch () from /usr/lib/libc.so.12
 | #4  0x00007f7fef4db0ea in getaddrinfo () from /usr/lib/libc.so.12
 | #5  0x00000000005e0761 in resolve_hostname (net=NET_TYPE_NONE, 
 |     host=0x7f7ff7efa0d0 "germ") at host_addr.c:1315
 | #6  name_to_host_addr (host=host@entry=0x7f7ff7efa0d0 "germ", 
 |     net=net@entry=NET_TYPE_NONE) at host_addr.c:1456
 | #7  0x00000000005c9042 in entropy_collect_host (ctx=0x7f7ff7fa4ad0)
 |     at entropy.c:1012
 | #8  0x000000000069952c in entropy_array_cb_collect (len=26, 
 |     ary=0x7f7ff7fa4b40, ctx=0x7f7ff7fa4ad0) at entropy.c:366
 | #9  entropy_collect_internal (digest=digest@entry=0x7f7ff7fa4ca0, 
 |     can_malloc=can_malloc@entry=1, slow=1) at entropy.c:1167
 | #10 0x00000000006996d3 in entropy_do_collect (digest=0x7f7ff7fa4ca0)
 |     at entropy.c:1476
 | #11 0x00000000005c96f7 in entropy_do_fill (buffer=0xb2ca90 <aje_state+16>, 
 |     len=16) at entropy.c:1574
 | #12 0x00000000005b441d in aje_init (as=as@entry=0xb2ca80 <aje_state>)
 |     at aje.c:693
 | #13 0x00000000005b44c3 in aje_default_init () at aje.c:729
 | #14 0x000000000069c5c1 in once_flag_run_internal (
 |     flag=flag@entry=0xb2ca64 <aje_initialized>, 
 |     routine=routine@entry=0x5b44b5 <aje_default_init>, 
 |     recursive=recursive@entry=0) at once.c:144
 | #15 0x00000000005f5c28 in once_flag_run_internal (recursive=0, 
 |     routine=routine@entry=0x5b44b5 <aje_default_init>, 
 |     flag=flag@entry=0xb2ca64 <aje_initialized>) at once.c:169
 | #16 once_flag_run (flag=flag@entry=0xb2ca64 <aje_initialized>, 
 |     routine=routine@entry=0x5b44b5 <aje_default_init>) at once.c:170
 | #17 0x00000000005b48d3 in aje_addrandom (src=src@entry=0xb38080 <data>, 
 |     len=len@entry=256) at aje.c:749
 | #18 0x0000000000602fa9 in random_add (data=data@entry=0xb38080 <data>, 
 |     datalen=datalen@entry=256) at random.c:1067
 | #19 0x00000000006030ab in random_add_pool (len=2, buf=0x7f7ff7fa4ece)
 |     at random.c:735
 | #20 random_pool_append (buf=buf@entry=0x7f7ff7fa4eee, len=len@entry=2)
 |     at random.c:838
 | #21 0x00000000005c9a51 in entropy_harvest_time () at entropy.c:1726
 | #22 0x00000000005bec7b in cq_run_idle (cq=0x7f7ff7fb4000) at cq.c:1885
 | #23 0x00000000005bfa48 in cq_idle (cq=<optimized out>) at cq.c:1307
 | #24 0x00000000005ccd75 in evq_thread_main (unused_arg=unused_arg@entry=0x0)
 |     at evq.c:205
 | #25 0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb9020)
 |     at thread.c:7482
 | #26 0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 | 
 | 
 | One other thing too:  my getaddrinfo wasn't able to find "germ",
 | the name returned by calls to `hostname'.
 | 
 | I added it to my /etc/hosts and it seemed to do the trick,
 | however gtk-gnutella still hangs :(

 Do you know where it hangs? In getaddrinfo() like you are showing above?

 christos

From: Germain Le Chapelain <german@free.fr>
To: gnats-bugs@NetBSD.org
Cc: adam@NetBSD.org,  gnats-admin@netbsd.org,  pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Wed, 21 Oct 2015 17:12:01 +0000

 christos@zoulas.com (Christos Zoulas) writes:

 >  | > localtime() is not async-signal-safe...
 >  | >
 >  | > http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
 >  | > Please install the debugging symbol libraries for the base system or build with
 >  | > MKDEBUG=yes.
 >  | 
 >  | Thanks !
 >  | 
 >  | 
 >  | I deleted the offending lines.
 >  | 
 >  | Now I get similar results with getaddrinfo()
 >  | 
 >  | 
 >  | [Switching to LWP 1]
 >  | 0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 >  | (gdb) bt
 >  | #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 >  | #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 >  | #2  0x00007f7fef807f43 in ?? () from /usr/lib/libpthread.so.1
 >  | #3  0x00007f7fef4f31b3 in nsdispatch () from /usr/lib/libc.so.12
 >  | #4  0x00007f7fef4db0ea in getaddrinfo () from /usr/lib/libc.so.12
 >  | #5  0x00000000005e0761 in resolve_hostname (net=NET_TYPE_NONE, 
 >  |     host=0x7f7ff7efa0d0 "germ") at host_addr.c:1315
 >  | #6  name_to_host_addr (host=host@entry=0x7f7ff7efa0d0 "germ", 
 >  |     net=net@entry=NET_TYPE_NONE) at host_addr.c:1456
 >  | #7  0x00000000005c9042 in entropy_collect_host (ctx=0x7f7ff7fa4ad0)
 >  |     at entropy.c:1012
 >  | #8  0x000000000069952c in entropy_array_cb_collect (len=26, 
 >  |     ary=0x7f7ff7fa4b40, ctx=0x7f7ff7fa4ad0) at entropy.c:366
 >  | #9  entropy_collect_internal (digest=digest@entry=0x7f7ff7fa4ca0, 
 >  |     can_malloc=can_malloc@entry=1, slow=1) at entropy.c:1167
 >  | #10 0x00000000006996d3 in entropy_do_collect (digest=0x7f7ff7fa4ca0)
 >  |     at entropy.c:1476
 >  | #11 0x00000000005c96f7 in entropy_do_fill (buffer=0xb2ca90 <aje_state+16>, 
 >  |     len=16) at entropy.c:1574
 >  | #12 0x00000000005b441d in aje_init (as=as@entry=0xb2ca80 <aje_state>)
 >  |     at aje.c:693
 >  | #13 0x00000000005b44c3 in aje_default_init () at aje.c:729
 >  | #14 0x000000000069c5c1 in once_flag_run_internal (
 >  |     flag=flag@entry=0xb2ca64 <aje_initialized>, 
 >  |     routine=routine@entry=0x5b44b5 <aje_default_init>, 
 >  |     recursive=recursive@entry=0) at once.c:144
 >  | #15 0x00000000005f5c28 in once_flag_run_internal (recursive=0, 
 >  |     routine=routine@entry=0x5b44b5 <aje_default_init>, 
 >  |     flag=flag@entry=0xb2ca64 <aje_initialized>) at once.c:169
 >  | #16 once_flag_run (flag=flag@entry=0xb2ca64 <aje_initialized>, 
 >  |     routine=routine@entry=0x5b44b5 <aje_default_init>) at once.c:170
 >  | #17 0x00000000005b48d3 in aje_addrandom (src=src@entry=0xb38080 <data>, 
 >  |     len=len@entry=256) at aje.c:749
 >  | #18 0x0000000000602fa9 in random_add (data=data@entry=0xb38080 <data>, 
 >  |     datalen=datalen@entry=256) at random.c:1067
 >  | #19 0x00000000006030ab in random_add_pool (len=2, buf=0x7f7ff7fa4ece)
 >  |     at random.c:735
 >  | #20 random_pool_append (buf=buf@entry=0x7f7ff7fa4eee, len=len@entry=2)
 >  |     at random.c:838
 >  | #21 0x00000000005c9a51 in entropy_harvest_time () at entropy.c:1726
 >  | #22 0x00000000005bec7b in cq_run_idle (cq=0x7f7ff7fb4000) at cq.c:1885
 >  | #23 0x00000000005bfa48 in cq_idle (cq=<optimized out>) at cq.c:1307
 >  | #24 0x00000000005ccd75 in evq_thread_main (unused_arg=unused_arg@entry=0x0)
 >  |     at evq.c:205
 >  | #25 0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb9020)
 >  |     at thread.c:7482
 >  | #26 0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 >  | 
 >  | 
 >  | One other thing too:  my getaddrinfo wasn't able to find "germ",
 >  | the name returned by calls to `hostname'.
 >  | 
 >  | I added it to my /etc/hosts and it seemed to do the trick,
 >  | however gtk-gnutella still hangs :(
 >  
 >  Do you know where it hangs? In getaddrinfo() like you are showing above?

 I think so !


 This is exactly the call stack I see in gdb when attaching to the process after waiting 
 a few minutes of nothing.


 I can try with the debug on from your earlier suggestion,


 From the look of it it seems more precisely locked in that nsdispatch() function,


 Germain

 -- 
 Germain
 http://german.free.fr

From: christos@zoulas.com (Christos Zoulas)
To: Germain Le Chapelain <german@free.fr>, gnats-bugs@NetBSD.org
Cc: adam@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Wed, 21 Oct 2015 20:51:30 -0400

 On Oct 21,  5:12pm, german@free.fr (Germain Le Chapelain) wrote:
 -- Subject: Re: pkg/49851

 | I think so !
 | 
 | 
 | This is exactly the call stack I see in gdb when attaching to the process after waiting 
 | a few minutes of nothing.
 | 
 | 
 | I can try with the debug on from your earlier suggestion,
 | 
 | 
 | >From the look of it it seems more precisely locked in that nsdispatch() function,
 | 

 Interesting...
 Can you do "info thread" and then "thread <n>" on each and "where"?
 Or how do I reproduce it? What do I need to install?


 christos

From: Germain Le Chapelain <german@free.fr>
To: gnats-bugs@NetBSD.org
Cc: adam@NetBSD.org,  gnats-admin@netbsd.org,  pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49851
Date: Fri, 30 Oct 2015 22:12:17 +0000

 christos@zoulas.com (Christos Zoulas) writes:

 >  Interesting...
 >  Can you do "info thread" and then "thread <n>" on each and "where"?

 Thanks !

 I did and I spotted another call to get local time

 I commented it out as well,

 Now in top I see

 18855 german    85    0   127M   11M netio/1    0:25  0.00%  0.00% gtk-gnutella

 in gdb, I see

 gdb) info thread
   Id   Target Id         Frame 
   6    LWP 2             0x00007f7fef43c42a in _sys___nanosleep50 ()
    from /usr/lib/libc.so.12
   5    LWP 3             0x00007f7fef43c3ea in poll ()
    from /usr/lib/libc.so.12
   4    LWP 5             0x00007f7fef49f65a in ___lwp_park60 ()
    from /usr/lib/libc.so.12
   3    LWP 6             0x00007f7fef49f65a in ___lwp_park60 ()
    from /usr/lib/libc.so.12
   2    LWP 7             0x00007f7fef49f65a in ___lwp_park60 ()
    from /usr/lib/libc.so.12
 * 1    LWP 1             0x00007f7fef49f65a in ___lwp_park60 ()
    from /usr/lib/libc.so.12

 (gdb) where 20
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 #2  0x00007f7fef807dbc in ?? () from /usr/lib/libpthread.so.1
 #3  0x00007f7fef80a29a in pthread_create () from /usr/lib/libpthread.so.1
 #4  0x000000000062c4d1 in thread_launch (stack=32768, flags=0, 
     arg=0x7f7ff7beaf08, routine=0x6b75a0 <tquicksort>, te=0x7f7ff7edaa58)
     at thread.c:7618
 #5  thread_create_full (routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7beaf08, flags=flags@entry=0, 
     stack=stack@entry=32768, exited=exited@entry=0x0, earg=earg@entry=0x0)
     at thread.c:7727
 #6  0x000000000062c7ab in thread_create (
     routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7beaf08, flags=flags@entry=0, 
     stack=stack@entry=32768) at thread.c:7653
 #7  0x00000000006b81ea in tquicksort (arg=arg@entry=0x7f7ff7bffee0)
     at tqsort.c:377
 #8  0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb90e0)
     at thread.c:7482
 #9  0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #10 0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #11 0x2c8e0680169bfc51 in ?? ()
 #12 0x2c8e33f9ec7b233d in ?? ()


 gdb) thread 2
 [Switching to thread 2 (LWP 7)]
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 (gdb) where 20
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 #2  0x00007f7fef807dbc in ?? () from /usr/lib/libpthread.so.1
 #3  0x00007f7fef80a29a in pthread_create () from /usr/lib/libpthread.so.1
 #4  0x000000000062c4d1 in thread_launch (stack=32768, flags=0, 
     arg=0x7f7ff7beaf08, routine=0x6b75a0 <tquicksort>, te=0x7f7ff7edaa58)
     at thread.c:7618
 #5  thread_create_full (routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7beaf08, flags=flags@entry=0, 
     stack=stack@entry=32768, exited=exited@entry=0x0, earg=earg@entry=0x0)
     at thread.c:7727
 #6  0x000000000062c7ab in thread_create (
     routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7beaf08, flags=flags@entry=0, 
     stack=stack@entry=32768) at thread.c:7653
 #7  0x00000000006b81ea in tquicksort (arg=arg@entry=0x7f7ff7bffee0)
     at tqsort.c:377
 #8  0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb90e0)
     at thread.c:7482
 #9  0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #10 0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #11 0x2c8e0680169bfc51 in ?? ()
 #12 0x2c8e33f9ec7b233d in ?? ()

 (gdb) thread 3
 [Switching to thread 3 (LWP 6)]
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 (gdb) where 20
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 #2  0x00007f7fef807dbc in ?? () from /usr/lib/libpthread.so.1
 #3  0x00007f7fef80a29a in pthread_create () from /usr/lib/libpthread.so.1
 #4  0x000000000062c4d1 in thread_launch (stack=32768, flags=0, 
     arg=0x7f7ff7bffe48, routine=0x6b75a0 <tquicksort>, te=0x7f7ff7eda740)
     at thread.c:7618
 #5  thread_create_full (routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7bffe48, flags=flags@entry=0, 
     stack=stack@entry=32768, exited=exited@entry=0x0, earg=earg@entry=0x0)
     at thread.c:7727
 #6  0x000000000062c7ab in thread_create (
     routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7bffe48, flags=flags@entry=0, 
     stack=stack@entry=32768) at thread.c:7653
 #7  0x00000000006b81ea in tquicksort (arg=arg@entry=0x7f7ff7bfff08)
     at tqsort.c:377
 #8  0x00000000006b77fe in tquicksort (arg=arg@entry=0x7f7fffffd7b8)
     at tqsort.c:392
 #9  0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb90e0)
     at thread.c:7482
 #10 0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #11 0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #12 0x00010102464c457f in ?? ()

 (gdb) thread 4
 [Switching to thread 4 (LWP 5)]
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 (gdb) where 20
 #0  0x00007f7fef49f65a in ___lwp_park60 () from /usr/lib/libc.so.12
 #1  0x00007f7fef80ad55 in pthread.park () from /usr/lib/libpthread.so.1
 #2  0x00007f7fef807dbc in ?? () from /usr/lib/libpthread.so.1
 #3  0x00007f7fef80a29a in pthread_create () from /usr/lib/libpthread.so.1
 #4  0x000000000062c4d1 in thread_launch (stack=32768, flags=0, 
     arg=0x7f7ff7f23ee0, routine=0x6b75a0 <tquicksort>, te=0x7f7ff7ed0000)
     at thread.c:7618
 #5  thread_create_full (routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7f23ee0, flags=flags@entry=0, 
     stack=stack@entry=32768, exited=exited@entry=0x0, earg=earg@entry=0x0)
     at thread.c:7727
 #6  0x000000000062c7ab in thread_create (
     routine=routine@entry=0x6b75a0 <tquicksort>, 
     arg=arg@entry=0x7f7ff7f23ee0, flags=flags@entry=0, 
     stack=stack@entry=32768) at thread.c:7653
 #7  0x00000000006b7b93 in tquicksort (arg=arg@entry=0x7f7fffffd850)
     at tqsort.c:317
 #8  0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb90a0)
     at thread.c:7482
 #9  0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #10 0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #11 0x0000000000b4bd08 in local_pmap ()
 #12 0x0000000000810080 in vendor_map ()
 #13 0x0000000100000949 in ?? ()
 #14 0x0000000000aaee30 in ?? ()
 #15 0x00000000008144a8 in assertion_data_.17186 ()
 #16 0x00000000000005f7 in ?? ()
 #17 0x0000000000aaee30 in ?? ()
 #18 0x00000000008144a8 in assertion_data_.17186 ()

 (gdb) thread 5
 [Switching to thread 5 (LWP 3)]
 (gdb) where 40
 #0  0x00007f7fef43c3ea in poll () from /usr/lib/libc.so.12
 #1  0x00007f7fef8070f7 in poll () from /usr/lib/libpthread.so.1
 #2  0x00000000005bca75 in compat_poll (fds=<optimized out>, 
     n=<optimized out>, timeout=<optimized out>) at compat_poll.c:175
 #3  0x000000000062ceee in thread_element_block_until (
     te=te@entry=0x7f7ff7fca318, events=<optimized out>, 
     end=end@entry=0x7f7ff7fa4ed0) at thread.c:6990
 #4  0x000000000062d52d in thread_sleep_interruptible (ms=<optimized out>, 
     mask=mask@entry=0x7f7ff7fa4f3c, interrupt=interrupt@entry=1)
     at thread.c:9302
 #5  0x000000000062e624 in thread_timed_sigsuspend (
     mask=mask@entry=0x7f7ff7fa4f3c, timeout=timeout@entry=0x7f7ff7fa4f40)
     at thread.c:9372
 #6  0x00000000005cccf4 in evq_thread_main (unused_arg=unused_arg@entry=0x0)
     at evq.c:253
 #7  0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb9020)
     at thread.c:7482
 #8  0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #9  0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #10 0x0000000000aae940 in ?? ()
 #11 0x00000000007980a8 in assertion_data_ ()
 #12 0x0000000000002437 in ?? ()
 #13 0x0000000000b76408 in xfreelist ()
 #14 0x00000000008144a8 in assertion_data_.17186 ()

 gdb) thread 6
 [Switching to thread 6 (LWP 2)]
 #0  0x00007f7fef43c42a in _sys___nanosleep50 () from /usr/lib/libc.so.12
 (gdb) where 40
 #0  0x00007f7fef43c42a in _sys___nanosleep50 () from /usr/lib/libc.so.12
 #1  0x00007f7fef8070ae in __nanosleep50 () from /usr/lib/libpthread.so.1
 #2  0x0000000000655b5c in compat_sleep_ms (ms=ms@entry=1000)
     at compat_sleep_ms.c:67
 #3  0x000000000062fea0 in tm_thread_main (unused_arg=unused_arg@entry=0x0)
     at tm.c:446
 #4  0x000000000062c192 in thread_launch_trampoline (arg=0x7f7ff7fb9000)
     at thread.c:7482
 #5  0x00007f7fef80a9cc in ?? () from /usr/lib/libpthread.so.1
 #6  0x00007f7fef483d90 in ?? () from /usr/lib/libc.so.12
 #7  0x00007f7ff7f95180 in ?? ()



 >  Or how do I reproduce it? What do I need to install?

 I have been installing the gtk-gnutella from pkgsrc with the following patch:

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/net/gtk-gnutella/Makefile,v
 retrieving revision 1.90
 diff -r1.90 Makefile
 3c3
 < DISTNAME=	gtk-gnutella-0.96.6
 ---
 > DISTNAME=	gtk-gnutella-1.1.5
 Index: PLIST
 ===================================================================
 RCS file: /cvsroot/pkgsrc/net/gtk-gnutella/PLIST,v
 retrieving revision 1.16
 diff -r1.16 PLIST
 31c31
 < share/gtk-gnutella/pixmaps/icon.32x32.xpm
 ---
 > share/gtk-gnutella/pixmaps/icon.48x48.xpm
 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/net/gtk-gnutella/distinfo,v
 retrieving revision 1.30
 diff -r1.30 distinfo
 3,7c3,13
 < SHA1 (gtk-gnutella-0.96.6.tar.bz2) = 319417e8de104b33913e08a0aaec8c0f22a6129d
 < RMD160 (gtk-gnutella-0.96.6.tar.bz2) = 0dae6af9ac64fa8d75980cafd55c5a3e9eb18dfe
 < Size (gtk-gnutella-0.96.6.tar.bz2) = 15739240 bytes
 < SHA1 (patch-aa) = 0df2e52177c1601b0533862a841ef61b2ac440ca
 < SHA1 (patch-ab) = 45d59a62acbfa38a952cf31e8ceecacc9c90f077
 ---
 > SHA1 (gtk-gnutella-1.1.5.tar.bz2) = d442ae404dfb66470fdd9114bedbe7d44bb0fb81
 > RMD160 (gtk-gnutella-1.1.5.tar.bz2) = 8e20f1959178e028a58d8b8adf2995b5dcf6f2e9
 > Size (gtk-gnutella-1.1.5.tar.bz2) = 19552392 bytes
 > SHA1 (patch-Configure) = 7739c9ed21f5e3e1d8f3f44292eeed2a08cdcee8
 > SHA1 (patch-src_lib_entropy.c) = 62e7e673f91020d0b425ed889fb2881c0177997e
 > SHA1 (patch-src_lib_log.c) = 22874575a49c96be45d3b37f10752144abd7e8d1
 > SHA1 (patch-src_lib_pow2.h) = 59684509ca8bfabacbb5c01b95ff2259a7991614
 > SHA1 (patch-src_lib_rand31.c) = da39a3ee5e6b4b0d3255bfef95601890afd80709
 > SHA1 (patch-src_lib_thread.h) = f2ba18a5906f47793763029f7afe1a9491136821
 > SHA1 (patch-src_lib_tm.c) = 2adb5ae79ced7b39d3b2a13f71b7db4127d35649
 > SHA1 (patch-src_shell_thread.c) = 00fb9c1afd3bbfc1d6be67e24850c6b12296a783
 Index: patches/patch-Configure
 ===================================================================
 RCS file: patches/patch-Configure
 diff -N patches/patch-Configure
 0a1,16
 > $NetBSD$
 > 
 > --- Configure.orig	2015-10-08 16:15:32.000000000 +0000
 > +++ Configure
 > @@ -4591,6 +4591,11 @@ eval $trylink
 >  set libintl.h i_libintl
 >  eval $inhdr
 >  
 > +d_gettext="$define"
 > +i_libintl="$define"
 > +d_nls="$define"
 > +d_enablenls="$define"
 > +
 >  : determine whether we support NLS
 >  echo " "
 >  case "$d_nls" in
 Index: patches/patch-aa
 ===================================================================
 RCS file: patches/patch-aa
 diff -N patches/patch-aa
 1,16d0
 < $NetBSD: patch-aa,v 1.9 2009/05/05 06:46:56 adam Exp $
 < 
 < --- Configure.orig	2009-03-29 17:37:52.000000000 +0200
 < +++ Configure
 < @@ -4043,6 +4043,11 @@ done'
 <  set libintl.h i_libintl
 <  eval $inhdr
 <  
 < +d_gettext="$define"
 < +i_libintl="$define"
 < +d_nls="$define"
 < +d_enablenls="$define"
 < +
 <  : determine whether we support NLS
 <  echo " "
 <  case "$d_nls" in
 Index: patches/patch-ab
 ===================================================================
 RCS file: patches/patch-ab
 diff -N patches/patch-ab
 1,22d0
 < $NetBSD: patch-ab,v 1.7 2009/07/14 09:41:31 hasso Exp $
 < 
 < SVN rev 16947 from upstream.
 < 
 < --- src/lib/entropy.c.orig	2009-07-14 12:11:05 +0300
 < +++ src/lib/entropy.c	2009-07-14 12:11:54 +0300
 < @@ -120,15 +120,12 @@ entropy_collect(struct sha1 *digest)
 <  		 * Compute the SHA1 of the output (either ps or /dev/urandom).
 <  		 */
 <  
 < -		SHA1Input(&ctx, f, sizeof *f);		/* Initial state */
 < -
 <  		for (;;) {
 <  			guint8 data[1024];
 <  			int r;
 <  			int len = is_pipe ? sizeof(data) : 128;
 <  
 <  			r = fread(data, 1, len, f);
 < -			SHA1Input(&ctx, f, sizeof *f);	/* Changes as we read */
 <  			if (r)
 <  				SHA1Input(&ctx, data, r);
 <  			if (r < len || !is_pipe)		/* Read once from /dev/urandom */
 Index: patches/patch-src_lib_entropy.c
 ===================================================================
 RCS file: patches/patch-src_lib_entropy.c
 diff -N patches/patch-src_lib_entropy.c
 0a1,31
 > $NetBSD$
 > 
 > --- src/lib/entropy.c.orig	2015-10-08 16:15:36.000000000 +0000
 > +++ src/lib/entropy.c
 > @@ -1252,7 +1252,7 @@ entropy_seed(struct entropy_minictx *c)
 >  	tm_precise_time(&now);		/* Do not use tm_now_exact(), it's too soon */
 >  	SHA1_INPUT(&ctx, now);
 >  
 > -	j = popcount(now.tv_nsec);
 > +	j = popcount_(now.tv_nsec);
 >  	for (i = 0; i <= j; i++) {
 >  		ENTROPY_CONTEXT_FEED;
 >  	}
 > @@ -1334,7 +1334,7 @@ entropy_seed(struct entropy_minictx *c)
 >  	SHA1_INPUT(&ctx, now);
 >  
 >  	tm_precise_time(&now);
 > -	j = popcount(now.tv_nsec * 11);
 > +	j = popcount_(now.tv_nsec * 11);
 >  	for (i = 0; i <= j; i++) {
 >  		ENTROPY_CONTEXT_FEED;
 >  	}
 > @@ -1351,7 +1351,7 @@ entropy_seed(struct entropy_minictx *c)
 >  
 >  		entropy_delay();
 >  		tm_precise_time(&now);
 > -		n = popcount(peek_be32(p) + now.tv_nsec);
 > +		n = popcount_(peek_be32(p) + now.tv_nsec);
 >  		j = UINT32_ROTR(v, n) & 0xff;
 >  		for (i = 0; i <= j; i++) {
 >  			ENTROPY_CONTEXT_FEED;
 Index: patches/patch-src_lib_log.c
 ===================================================================
 RCS file: patches/patch-src_lib_log.c
 diff -N patches/patch-src_lib_log.c
 0a1,73
 > $NetBSD$
 > 
 > --- src/lib/log.c.orig	2015-10-08 16:15:36.000000000 +0000
 > +++ src/lib/log.c
 > @@ -638,7 +638,7 @@ log_printable(enum log_file which)
 >   * Emit log message.
 >   */
 >  static void
 > -log_fprint(enum log_file which, const struct tm *ct, long usec,
 > +log_fprint(enum log_file which, long usec,
 >  	GLogLevelFlags level, const char *prefix, unsigned stid, const char *msg)
 >  {
 >  	struct logfile *lf;
 > @@ -647,7 +647,7 @@ log_fprint(enum log_file which, const st
 >  	str_t *ls;
 >  	ssize_t w;
 >  
 > -#define FORMAT_STR	"%02d-%02d-%02d %.02d:%.02d:%.02d.%03ld (%s)%s%s: %s\n"
 > +#define FORMAT_STR	"%03ld (%s)%s%s: %s\n"
 >  
 >  	log_file_check(which);
 >  
 > @@ -675,9 +675,7 @@ log_fprint(enum log_file which, const st
 >  		ls = logstring_object();
 >  
 >  	str_printf(ls, FORMAT_STR,
 > -		(TM_YEAR_ORIGIN + ct->tm_year) % 100,
 > -		ct->tm_mon + 1, ct->tm_mday,
 > -		ct->tm_hour, ct->tm_min, ct->tm_sec, usec / 1000, tprefix,
 > +		usec / 1000, tprefix,
 >  		(level & G_LOG_FLAG_RECURSION) ? " [RECURSIVE]" : "",
 >  		(level & G_LOG_FLAG_FATAL) ? " [FATAL]" : "",
 >  		msg);
 > @@ -1977,8 +1975,9 @@ log_handler(const char *domain, GLogLeve
 >  	const char *message, void *unused_data)
 >  {
 >  	int saved_errno = errno;
 > -	time_t now;
 > -	struct tm *ct;
 > +
 > +	
 > +
 >  	tm_t tv;
 >  	const char *prefix;
 >  	char *safer;
 > @@ -1990,8 +1989,8 @@ log_handler(const char *domain, GLogLeve
 >  		return;
 >  
 >  	tm_now_exact(&tv);
 > -	now = tv.tv_sec;
 > -	ct = localtime(&now);
 > +
 > +	
 >  
 >  	prefix = log_prefix(level);
 >  	stid = thread_small_id();
 > @@ -2003,14 +2002,14 @@ log_handler(const char *domain, GLogLeve
 >  		safer = control_escape(message);
 >  	}
 >  
 > -	log_fprint(LOG_STDERR, ct, tv.tv_usec, level, prefix, stid, safer);
 > +	log_fprint(LOG_STDERR, tv.tv_usec, level, prefix, stid, safer);
 >  
 >  	if G_UNLIKELY(
 >  		level &
 >  			(G_LOG_FLAG_FATAL | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR)
 >  	) {
 >  		if (log_stdout_is_distinct())
 > -			log_fprint(LOG_STDOUT, ct, tv.tv_usec, level, prefix, stid, safer);
 > +			log_fprint(LOG_STDOUT, tv.tv_usec, level, prefix, stid, safer);
 >  		if (level & G_LOG_FLAG_FATAL)
 >  			crash_set_error(safer);
 >  	}
 Index: patches/patch-src_lib_pow2.h
 ===================================================================
 RCS file: patches/patch-src_lib_pow2.h
 diff -N patches/patch-src_lib_pow2.h
 0a1,31
 > $NetBSD$
 > 
 > --- src/lib/pow2.h.orig	2015-10-08 16:15:36.000000000 +0000
 > +++ src/lib/pow2.h
 > @@ -67,7 +67,7 @@ is_pow2(uint32 value)
 >   * @return number of 1 bits in a 32-bit integer.
 >   */
 >  static inline ALWAYS_INLINE G_GNUC_CONST int
 > -popcount(uint32 x)
 > +popcount_(uint32 x)
 >  #ifdef HAS_BUILTIN_POPCOUNT
 >  {
 >  	return __builtin_popcount(x);
 > @@ -153,7 +153,7 @@ clz(uint32 x)
 >  	x |= x >> 4;
 >  	x |= x >> 8;
 >  	x |= x >> 16;
 > -	return 32 - popcount(x);
 > +	return 32 - popcount_(x);
 >  }
 >  #endif	/* HAS_BUILTIN_CLZ */
 >  
 > @@ -176,7 +176,7 @@ int bits_set(uint8 b) G_GNUC_PURE;
 >  static inline ALWAYS_INLINE G_GNUC_CONST int
 >  bits_set32(uint32 v)
 >  {
 > -	return popcount(v);
 > +	return popcount_(v);
 >  }
 >  
 >  #endif /* _pow2_h_ */
 Index: patches/patch-src_lib_rand31.c
 ===================================================================
 RCS file: patches/patch-src_lib_rand31.c
 diff -N patches/patch-src_lib_rand31.c
 Index: patches/patch-src_lib_thread.h
 ===================================================================
 RCS file: patches/patch-src_lib_thread.h
 diff -N patches/patch-src_lib_thread.h
 0a1,15
 > $NetBSD$
 > 
 > --- src/lib/thread.h.orig	2015-10-08 16:15:36.000000000 +0000
 > +++ src/lib/thread.h
 > @@ -36,6 +36,10 @@
 >  
 >  #include "tsig.h"		/* For tsigset_t */
 >  
 > +#ifndef PTHREAD_STACK_MIN
 > +#define PTHREAD_STACK_MIN 0
 > +#endif
 > +
 >  /**
 >   * Main entry point for thread_create().
 >   */
 Index: patches/patch-src_lib_tm.c
 ===================================================================
 RCS file: patches/patch-src_lib_tm.c
 diff -N patches/patch-src_lib_tm.c
 0a1,24
 > $NetBSD$
 > 
 > --- src/lib/tm.c.orig	2015-10-08 16:15:36.000000000 +0000
 > +++ src/lib/tm.c
 > @@ -330,8 +330,8 @@ tm_updated(const tm_t *prev, const tm_t 
 >  	need_update = gentime_diff(gnow, tm_gmt.updated) > TM_GMT_PERIOD / 10
 >  		&& need_update;
 >  
 > -	if G_UNLIKELY(need_update)
 > -		tm_update_gmt_offset((time_t) now->tv_sec);
 > +	//	if G_UNLIKELY(need_update)
 > +	//	tm_update_gmt_offset((time_t) now->tv_sec);
 >  
 >  	/*
 >  	 * When time is shifting suddenly (system-wide time adjustment, either
 > @@ -364,7 +364,7 @@ tm_updated(const tm_t *prev, const tm_t 
 >  		s_message("TM system clock changed, delta=%+ld ms", (long) delta);
 >  	}
 >  
 > -	tm_update_gmt_offset((time_t) now->tv_sec);
 > +	//tm_update_gmt_offset((time_t) now->tv_sec);
 >  	tm_event_fire(delta);
 >  
 >  	if (tm_debugging(2)) {
 Index: patches/patch-src_shell_thread.c
 ===================================================================
 RCS file: patches/patch-src_shell_thread.c
 diff -N patches/patch-src_shell_thread.c
 0a1,23
 > $NetBSD$
 > 
 > --- src/shell/thread.c.orig	2015-10-08 16:15:37.000000000 +0000
 > +++ src/shell/thread.c
 > @@ -49,6 +49,9 @@
 >  
 >  #include "lib/override.h"		/* Must be the last header included */
 >  
 > +#include <limits.h>
 > +
 > +
 >  #define ACTIVE_THRESH	10		/**< (s) thread inactivity threshold */
 >  
 >  static enum shell_reply
 > @@ -105,7 +108,7 @@ shell_exec_thread_list(struct gnutella_s
 >  				delta_time(now, info.last_seen) > ACTIVE_THRESH) ? 'I' : 'R');
 >  		str_putc(s, ' ');
 >  		str_catf(s, "%-3zd ", info.locks);
 > -		str_catf(s, "%-4d ", popcount(info.sig_pending));
 > +		str_catf(s, "%-4d ", popcount_(info.sig_pending));
 >  		if (teq_is_supported(i)) {
 >  			str_catf(s, "%-4zu ", teq_count(i));
 >  		} else {


 -- 
 Germain
 http://german.free.fr

State-Changed-From-To: open->closed
State-Changed-By: adam@NetBSD.org
State-Changed-When: Tue, 07 Mar 2023 19:39:12 +0000
State-Changed-Why:
gtk-gnutella has been updated


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.