NetBSD Problem Report #57831

From  Mon Jan  8 23:12:49 2024
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id DC12A1A9238
	for <>; Mon,  8 Jan 2024 23:12:49 +0000 (UTC)
Message-Id: <>
Date: Mon,  8 Jan 2024 23:12:48 +0000 (UTC)
Subject: Memory leaks in libpthread/libc
X-Send-Pr-Version: www-1.0

>Number:         57831
>Category:       lib
>Synopsis:       Memory leaks in libpthread/libc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 08 23:15:00 +0000 2024
>Originator:     Brian Marcotte
>Release:        10.0
Public Access Networks, Corp
NetBSD 10.0_RC2 NetBSD 10.0_RC2 (PANIX-STD) #1: Sat Jan  6 00:27:58 EST 2024 amd64

After upgrading NetBSD-10, I've noticed that some daemons using pthread
have slow memory leaks. I've seen the problem in these daemons:

    dkimpy_milter (python3)
    syslog-ng (only in some cases)

Also, we're getting segfaults in nnrpd (from INN) linked with libperl
when the perl code is called.

I attempted to track down when the problem began but it looks like there
may be more than one issue. I think problems may have been introduced in
these places:


  1.156 -> 1.157 src/lib/libpthread/pthread.c
  1.98  -> 1.99  src/lib/libpthread/pthread_int.h


  1.2   -> 1.3   external/bsd/jemalloc/dist/src/tsd.c
  1.12  -> 1.13  external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
  1.173 -> 1.174 lib/libpthread/pthread.c

joerg and ad were working on these libraries at those times.

The second set of commits were easy to back out from modern sources. This
fixed the nnrpd/libperl problem. It made the memory leak issue better,
but not fixed.

I also tried enabling JEMALLOC_PROF, but that made all programs segfault
on startup.

I'm in over my head at this point, so I decided to submit what little I


- Brian

I found that when running "gpg-agent --daemon", it's memory usage will
grow even if it's not being used in any way. The other programs required
that they were being used.


NetBSD Home
NetBSD PR Database Search

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