libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] daemon stalled


From: Markus Doppelbauer
Subject: Re: [libmicrohttpd] daemon stalled
Date: Thu, 14 Apr 2016 17:38:18 +0200

Hello,
You are right. But there is an issue (at least on Linux). It works with
"MHD_USE_EPOLL_LINUX_ONLY" - but not with "select()"/"poll()".
Sooner or later  the daemon gets stalled. Maybe a race condition?
I have attached the patched testcase.
Thanks a lot!
Markus



Am Donnerstag, den 14.04.2016, 17:35 +0300 schrieb Evgeny Grin:
Markus,

You have resources leak in your test.
Modify with
===================
--- test.cpp.orig        2016-04-14 16:38:27.000000000 +0300
+++ test.cpp    2016-04-14 17:26:17.677237034 +0300
@@ -24,7 +24,9 @@ static void suspend_connection( struct M
     pthread_t thread_id;
     pthread_attr_t thread_attr;
     pthread_attr_init( &thread_attr );
+    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
     pthread_create( &thread_id, &thread_attr, resume_connection,
connection );
+    pthread_attr_destroy(&thread_attr);
 }
===================
And it will work with current and previous versions of libmicrohttpd.
Otherwise you just run out of system resources.
Good that libmicrohttpd didn't crash even in this case. :)

Attachment: test.cpp
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]