public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-developers@cygwin.com
Subject: Re: malloc crash
Date: Tue, 26 Oct 2021 10:32:07 -0400	[thread overview]
Message-ID: <a0722985-6deb-5edd-09f9-06c1267ce0a2@cornell.edu> (raw)
In-Reply-To: <YXfJYd5qMwDf2Uav@calimero.vinschen.de>

On 10/26/2021 5:24 AM, Corinna Vinschen wrote:
> On Oct 25 18:02, Ken Brown wrote:
>> Or does the fifo_reader thread call a malloc function before the main thread
>> has called malloc_init()?  This would presumably cause __malloc_lock() to
>> fail, but there's no error check.
> 
> That sounds more likely.  In theory this shouldn't have much influence,
> though.  First of all, all fixup calls are running in a single thread,
> so there's no serialization required(*), and the malloc_init call
> doesn't set up the malloc arena, it just initializes the muto and checks
> for user space provided malloc calls, which is not a problem in this
> scenario.
> 
> (*) unless multiple threads are started during fixup and some of these
>      threads mallocate memory again...
> 
> Ken, is there a chance to tweak the fifo code to stop creating
> threads from inside fixup, and to defer the thread start to the first
> call in the process actually relying on the thread being started?

I can't think of any way to do that.  The thread is listening for various events 
that cause it to take action, so it has to always be running.  But I can 
probably tweak the code so that the thread doesn't have to call malloc early on.

It might take a while to get this right, and the bug has existed ever since I 
overhauled the fifo code.  So I don't think you have to hold up releasing 3.3.0 
while I work on this.

Ken

  reply	other threads:[~2021-10-26 14:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24 21:46 Ken Brown
2021-10-25  8:56 ` Takashi Yano
2021-10-25 13:37   ` Ken Brown
2021-10-25  8:59 ` Corinna Vinschen
2021-10-25 12:35   ` Ken Brown
2021-10-25 15:39     ` Corinna Vinschen
2021-10-25 21:29       ` Mark Geisert
2021-10-25 22:02         ` Ken Brown
2021-10-25 23:36           ` Mark Geisert
2021-10-26  0:18             ` Takashi Yano
2021-10-26  0:54               ` Mark Geisert
2021-10-26  8:30                 ` Mark Geisert
2021-10-26  8:52                   ` Takashi Yano
2021-10-26  8:59                     ` Mark Geisert
2021-10-26  9:26                       ` Takashi Yano
2021-10-26  9:31                         ` Corinna Vinschen
2021-10-26  9:28                       ` Corinna Vinschen
2021-10-26  9:27                 ` Corinna Vinschen
2021-10-26  9:24           ` Corinna Vinschen
2021-10-26 14:32             ` Ken Brown [this message]
2021-10-26 16:03               ` Corinna Vinschen
2021-10-26 16:36                 ` Ken Brown
2021-10-26 16:49                   ` Corinna Vinschen
2021-10-26 17:10                     ` Ken Brown
2021-10-27  0:44                     ` Takashi Yano
2021-10-27  9:01                       ` Corinna Vinschen
2021-10-26 16:44                 ` Takashi Yano

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=a0722985-6deb-5edd-09f9-06c1267ce0a2@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-developers@cygwin.com \
    /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).