libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] daemon stalled


From: Evgeny Grin
Subject: Re: [libmicrohttpd] daemon stalled
Date: Thu, 14 Apr 2016 17:35:00 +0300
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

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

-- 
Best Wishes,
Evgeny Grin



On 14.04.2016 14:59, Markus Doppelbauer wrote:
> Sorry - wrong testcase. The attached is the proper one.
> 
> Am Donnerstag, den 14.04.2016, 13:55 +0200 schrieb Markus Doppelbauer:
>> Hello,
>>
>> It seems that there is an other issue (is neither works with 0.9.48):
>> a) The connection creates a "callback" response
>> b) The connection is suspended after every byte - then resumed (by a
>> thread)
>> c) The daemon get stalled after 33 requests
>>
>> I have attached a small testcase.
>>
>> Commandline:
>> g++ -o testmhd test.cpp -I/tmp/libmicrohttpd/src/include/
>> -L/tmp/libmicrohttpd/src/microhttpd/.libs/ -lmicrohttpd -pthread
>> LD_LIBRARY_PATH=/tmp/libmicrohttpd/src/microhttpd/.libs/ ./testmhd
>> while [ 1 == 1 ]; do wget --server-response -q -O - 127.0.0.1:8080;
>> echo; done

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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