cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Xiao Yu <xyu@automattic.com>
Cc: Arkadi Colson <arkadi@smartbit.be>, cmogstored-public@yhbt.net
Subject: Re: Segfaults on http_close?
Date: Sat, 13 Feb 2021 02:19:19 +0000	[thread overview]
Message-ID: <20210213021919.GA29494@dcvr> (raw)
In-Reply-To: <CABfxMcW+kb5gwq3pSB_89P49EVv+4UkJXz+mUPQTy19AdrwbAg@mail.gmail.com>

Xiao Yu <xyu@automattic.com> wrote:
> On Fri, Feb 12, 2021 at 6:54 AM Eric Wong <e@80x24.org> wrote:
> >
> > Ping?  It's been a few weeks :>
> 
> Apologies for not getting back to you earlier! I just checked all of
> our logs across our 96 nodes and there's been no segfaults since the
> patch was deployed. I think we can call that fix good and tag a new
> version.
> 
> Thanks again for the quick fix and diagnosing the issue even with the
> limited amount of info I was able to provide.

No problem and thanks for the update!

I've pushed out the final patch as commit f441da11c290373
and will push out a 1.8.1 release in a few.
-------------8<------------
Date: Sat, 13 Feb 2021 01:03:58 +0000
Subject: [PATCH] thrpool: remove stack size changing for all platforms

As compilers and system C libraries change, the using a
non-default stack size is too risky and can lead to
difficult-to-diagnose problems.

Using the default stack size seems to solve the segfaults
at http_close reported by Xiao Yu <xyu@automattic.com>.

Users on modern 64-bit systems were unlikely to find any benefit
in using a small stack size with this code base.
Users on 32-bit systems who wish to continue with a minimal
stack should use "ulimit -s" in startup scripts or configure
their process manager appropriately (e.g. setting the
"LimitSTACK" directive in described in systemd.exec(5)).

Reported-and-tested-by: Xiao Yu <xyu@automattic.com>
Link: https://yhbt.net/cmogstored-public/CABfxMcW+kb5gwq3pSB_89P49EVv+4UkJXz+mUPQTy19AdrwbAg@mail.gmail.com/T/
---
 thrpool.c | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/thrpool.c b/thrpool.c
index bc67ea0..56a7ef0 100644
--- a/thrpool.c
+++ b/thrpool.c
@@ -12,24 +12,6 @@ struct mog_thr_start_arg {
 	unsigned *do_quit;
 };
 
-/*
- * we can lower this if we can test with lower values, NPTL minimum is 16K.
- * We also use syslog() and *printf() functions which take a lot of
- * stack under glibc, so we'll add BUFSIZ (8192 on glibc) to that
- */
-#if MOG_LIBKQUEUE /* libkqueue uses quite a bit of stack */
-#  define MOG_THR_STACK_SIZE (0)
-#elif defined(__GLIBC__) || defined(__FreeBSD__)
-#  define MOG_THR_STACK_SIZE ((16 * 1024) + MAX(8192,BUFSIZ))
-#  if defined(PTHREAD_STACK_MIN) && (PTHREAD_STACK_MIN > MOG_THR_STACK_SIZE)
-#    undef MOG_THR_STACK_SIZE
-#    define MOG_THR_STACK_SIZE PTHREAD_STACK_MIN
-#  endif
-#else
-#  define MOG_THR_STACK_SIZE (0)
-#endif
-static const size_t stacksize = (size_t)MOG_THR_STACK_SIZE;
-
 static sigset_t quitset;
 
 __attribute__((constructor)) static void thrpool_init(void)
@@ -141,9 +123,6 @@ thrpool_add(struct mog_thrpool *tp, unsigned size, unsigned long *nr_eagain)
 
 	CHECK(int, 0, pthread_attr_init(&attr));
 
-	if (stacksize > 0)
-		CHECK(int, 0, pthread_attr_setstacksize(&attr, stacksize));
-
 	thr = &tp->threads[tp->n_threads].thr;
 
 	CHECK(int, 0, pthread_mutex_lock(&arg.mtx));

      reply	other threads:[~2021-02-13  2:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 20:48 Segfaults on http_close? Xiao Yu
2021-01-11 21:26 ` Eric Wong
2021-01-17  9:51   ` Eric Wong
2021-01-20  5:21     ` Xiao Yu
2021-01-20  8:57       ` Eric Wong
2021-01-20 21:13         ` Xiao Yu
2021-01-20 21:22           ` Eric Wong
2021-01-25 17:36             ` Xiao Yu
2021-01-25 17:47               ` Eric Wong
2021-01-25 19:27                 ` Xiao Yu
2021-02-12  6:54                   ` Eric Wong
2021-02-12 21:18                     ` Xiao Yu
2021-02-13  2:19                       ` Eric Wong [this message]

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

  List information: https://yhbt.net/cmogstored/README

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

  git send-email \
    --in-reply-to=20210213021919.GA29494@dcvr \
    --to=e@80x24.org \
    --cc=arkadi@smartbit.be \
    --cc=cmogstored-public@yhbt.net \
    --cc=xyu@automattic.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.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/cmogstored.git/

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