View Issue Details

IDProjectCategoryView StatusLast Update
0003915libmicrohttpdthread poolpublic2015-09-16 14:31
ReporterChristian Grothoff Assigned ToChristian Grothoff  
PrioritynormalSeveritymajorReproducibilityhave not tried
Status closedResolutionno change required 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Version0.9.43 
Target Version0.9.43 
Summary0003915: connection hangs
DescriptionMarkus Doppelbauer reported on the mailinglist:

Maybe there is a race condition between suspending/resuming connection.
This happens only if I use "poll()" - not with "epoll()". Requests were
created using "wget" (http 1.0) - one after the other.

What I did:

The MHD-Thread calls "MHD_suspend_connection()" inside
"MHD_ContentReaderCallback()".
The worker thread calls "MHD_resume_connection()" if the connection is
suspended.
Sometimes the MHD thread sleeps forever - it does not continue to work
on
resume connections. The polling-variable "num_connections" is zero.

The "connection_suspended"-flag and calls to
"MHD_resume/suspend_connection()" are
protected by a mutex.

The callstack from the core-dump:

#0 0x00007f38889c512d in poll ()
at ../sysdeps/unix/syscall-template.S:81
#1 0x00000000006786c6 in MHD_poll_all (daemon=0x359a930, may_block=1)
at /home/markus/Website/gloriatv/dev/src/contrib/microhttpd/daemon.c:2485
#2 0x0000000000678ba9 in MHD_poll (daemon=0x359a930, may_block=1)
at /home/markus/Website/gloriatv/dev/src/contrib/microhttpd/daemon.c:2642
#3 0x0000000000679557 in MHD_select_thread (cls=0x359a930)
at /home/markus/Website/gloriatv/dev/src/contrib/microhttpd/daemon.c:2928
#4 0x00007f388a758182 in start_thread (arg=0x7f38846fb700) at
pthread_create.c:312
#5 0x00007f38889d247d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Locals on frame #1:
i = 0
timeout = -1
poll_server = 2
poll_listen = 0
tmp = 114 'r'
ltimeout = 301000
poll_pipe = 1
p = 0x7f387c0008c0
num_connections = 0
pos = 0x0
next = 0x0

Thanks a lot
Markus
Steps To ReproduceNone yet.
TagsNo tags attached.

Activities

Christian Grothoff

2015-09-16 14:31

manager   ~0009630

Markus now writes:

Die Sache war wohl mein Fehler - ich habe die Funktion
    MHD_get_daemon_info( MHD_DAEMON_INFO_CURRENT_CONNECTIONS )
von einem unbeteiligtem Thread aus augerufen. Bitte die beiden issues
schließen - und danke für die Hilfe.

Issue History

Date Modified Username Field Change
2015-07-25 15:48 Christian Grothoff New Issue
2015-07-25 15:51 Christian Grothoff Status new => acknowledged
2015-09-16 14:31 Christian Grothoff Note Added: 0009630
2015-09-16 14:31 Christian Grothoff Assigned To => Christian Grothoff
2015-09-16 14:31 Christian Grothoff Status acknowledged => resolved
2015-09-16 14:31 Christian Grothoff Resolution open => no change required
2015-09-16 14:31 Christian Grothoff Product Version => 0.9.43
2015-09-16 14:31 Christian Grothoff Target Version => 0.9.43
2015-09-16 14:31 Christian Grothoff Status resolved => closed
2024-01-21 13:25 Christian Grothoff Category libmicrohttpd multi-threaded operation => thread pool