mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Cc: Carl Chave <online@chave.us>, Rich Felker <dalias@libc.org>,
	musl@lists.openwall.com
Subject: Re: [musl] Hung processes with althttpd web server
Date: Thu, 5 Oct 2023 20:48:23 +0200	[thread overview]
Message-ID: <ZR8E97c60doZR1uG@voyager> (raw)
In-Reply-To: <CAGP1gyM8RjwT6YOk0iEGL_T_Ykk=XhpLtjTyyBoRtSyHXCC4BA@mail.gmail.com>

Am Thu, Oct 05, 2023 at 02:26:42PM -0400 schrieb Carl Chave:
> #5  0x00007f5fb449d7c0 in __pthread_mutex_lock
> (m=m@entry=0x7f5fb44e0880 <init_fini_lock>) at
> src/thread/pthread_mutex_lock.c:9
> #6  0x00007f5fb44a49ff in __libc_exit_fini () at ldso/dynlink.c:1442
> #7  0x00007f5fb445b082 in exit (code=0) at src/exit/exit.c:30
> #8  0x0000557471c3cf45 in ?? ()
> #9  <signal handler called>
> #10 0x00007f5fb43d3f20 in ?? () from /lib/libssl.so.3
> #11 0x00007f5fb44a4a9d in __libc_exit_fini () at ldso/dynlink.c:1453
> #12 0x00007f5fb445b082 in exit (code=0) at src/exit/exit.c:30

Oh, goddang it, I had just theorized that. The process is actually
finished and called exit(). exit() has in turn called
__libc_exit_fini(), which has taken the init_fini_lock and is now
calling the destructors. Apparently libssl has a destructor, and while
it is running the signal hits. And then the signal handler also calls
exit() (which is invalid, for exit() is not signal-safe), and tries to
call __libc_exit_fini() again, and that deadlocks on init_fini_lock.

But that also means that you sometimes get the other deadlock I
theorized in my other mail just now, the deadlock on "lock" in
dynlink.c. Because this backtrace does not fit the strace from earlier.

Solution is still the same as before: Either clean up the signal handler
or don't even register it in the first place. The proper place to log
unusual exit of a process is in the parent process. All of the
intercepted signals have a default action of Term or Core, so they will
cause the end of the process.

Ciao,
Markus


  reply	other threads:[~2023-10-05 18:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05  1:41 Carl Chave
2023-10-05  2:15 ` Rich Felker
2023-10-05  2:43   ` Carl Chave
2023-10-05 13:39     ` Szabolcs Nagy
2023-10-05 18:26       ` Carl Chave
2023-10-05 18:48         ` Markus Wichmann [this message]
2023-10-05 19:06           ` Carl Chave
2023-10-05  3:37 ` Markus Wichmann
2023-10-05 12:39   ` Rich Felker
2023-10-05 18:34     ` Markus Wichmann
2023-10-05 18:52   ` Carl Chave

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=ZR8E97c60doZR1uG@voyager \
    --to=nullplan@gmx.net \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=online@chave.us \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).