[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Extra worker thread on failed daemon start
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Extra worker thread on failed daemon start |
Date: |
Wed, 13 May 2015 11:36:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 |
Hi!
You're totally right, fixed in SVN 35728.
-Christian
On 05/13/2015 04:47 AM, Jared Cantwell wrote:
> Hey,
>
> I'm debugging a problem with a crash in MHD_select_thread. We had
> MHD_start_daemon_va fail while creating worker threads with the following
> error: "file descriptor for worker control pipe exceeds maximum value". We
> know what caused this error and are fixing it. But the problem was that a
> MHD_select_thread worker thread was left running in the background after
> MHD_start_daemon_va returned failure. I think the problem is from this
> code in the thread_failed case in daemon.c:
>
> /* Shutdown worker threads we've already created. Pretend
> as though we had fully initialized our daemon, but
> with a smaller number of threads than had been
> requested. */
> daemon->worker_pool_size = i - 1;
> MHD_stop_daemon (daemon);
> return NULL;
>
> From the code, it looks like "i" is actually the number of threads that
> were successfully created, so the "i - 1" in this code will leave an extra
> thread hanging since MHD_stop_daemon will clean up one less thread than it
> should. I'll probably try to work up a test to verify removing the "- 1"
> is correct, but that could take me some time so I wanted to make sure I
> wasn't missing something obvious before heading down that path.
>
> ~Jared
>