NetBSD Problem Report #57831

From www@netbsd.org  Mon Jan  8 23:12:49 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id DC12A1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  8 Jan 2024 23:12:49 +0000 (UTC)
Message-Id: <20240108231248.4151C1A9239@mollari.NetBSD.org>
Date: Mon,  8 Jan 2024 23:12:48 +0000 (UTC)
From: marcotte@panix.com
Reply-To: marcotte@panix.com
To: gnats-bugs@NetBSD.org
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
>Organization:
Public Access Networks, Corp
>Environment:
NetBSD mail1.panix.com 10.0_RC2 NetBSD 10.0_RC2 (PANIX-STD) #1: Sat Jan  6 00:27:58 EST 2024  root@xxx.panix.com:/misc/obj64/misc/devel/NO-BACKUPS/release-10/src/sys/arch/amd64/compile/PANIX-STD amd64

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

    gpg-agent
    opendmarc
    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:

2020/01/27:

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

2020/06/04:

  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
have.

Thanks.

- Brian

>How-To-Repeat:
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.


>Fix:

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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.