[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] MHD_handle_connection race leads to deadlock in MHD_
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] MHD_handle_connection race leads to deadlock in MHD_stop_daemon |
Date: |
Thu, 15 Oct 2009 09:34:21 +0200 |
User-agent: |
KMail/1.12.2 (Linux/2.6.28-grml64; KDE/4.3.2; x86_64; ; ) |
On Wednesday 14 October 2009 15:13:02 Mike Crowe wrote:
> I temporarily hacked around the problem by employing a similar
> fix. It's not ideal, as you say, but it does work. I'm in favour of
> it, at least in the short term.
>
> I did wonder whether it would be possible to use pthread_cancel and
> disable cancellation around calls to the callbacks but it would
> require a bit of work to ensure that the necessary cleanup occurred.
pthread_cancel is horrible and even without its inherent problems, given that
we have callbacks into arbitrary code (MHD-response!) we can not use it.
> It would appear that pselect is designed to solve this problem. I
> might try using it if it is available and fall back to your fix if
> not. Some care might be required if the code is relying on SIGALRM waking
> up reads and writes as well as the select.
pselect was designed to solve the problem, but pselect is not as portable
*and* on some systems (glibc!) the specific implementation of pselect still has
the same problem (see select man page). So I don't think pselect is a
worthwile direction to go into.
Best,
Christian
--
http://grothoff.org/christian/