public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "carlos at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/26022] valgrind gives me error when fwprintf in stderr
Date: Fri, 22 May 2020 20:07:02 +0000	[thread overview]
Message-ID: <bug-26022-131-5hjDgCobqY@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26022-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26022

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
Freeing streams during application shutdown is difficult because detached
threads may be writing to unbuffered streams.

As such, stderr, and any other unbuffered streams are untouched during process
shutdown and are not freed by the resource freeing API that glibc exposes for
use by external allocation trackers.

That is to say that __libc_freeres() the public API which glibc uses to expose
resource freeing, will not free unbuffered streams to allow any last minute
writes.

Since stderr starts as unbuffered it is not freed. You can make stderr
buffered, and subject to freeing like this: setvbuf (stderr, NULL, _IOLBF, 0);

Valgrind should probably have a suppresion entry added for stderr because it's
a common stream to be used by applications.

I've filed a Valgrind bug here:
https://bugs.kde.org/show_bug.cgi?id=421931

Please feel free to follow up there if you think it needs an update or you want
to give a +1 regarding your use case.

I'm marking this RESOLVED/INVALID for glibc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2020-05-22 20:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  7:45 [Bug libc/26022] New: " daffra.claudio at gmail dot com
2020-05-22 20:07 ` carlos at redhat dot com [this message]
2020-05-29 19:40 ` [Bug libc/26022] " mark at klomp dot org
2020-05-29 20:09 ` carlos at redhat dot com
2020-06-04  9:45 ` daffra.claudio at gmail dot com
2020-06-04 12:19 ` mark at klomp dot org
2020-06-04 16:58 ` daffra.claudio at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-26022-131-5hjDgCobqY@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).