libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Cleanup callback isn't called


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Cleanup callback isn't called
Date: Wed, 15 Sep 2010 09:38:33 +0200
User-agent: KMail/1.13.5 (Linux/2.6.32-5-686; KDE/4.4.5; i686; ; )

You're absolutely right.  Not sure how that happened (or why my tests never 
triggered it), but that needs to be changed as suggested.  Now done in SVN 
HEAD.

Best,

Christian

> I've run into another problem and also I think I have found the cause.
> 
> When a connection is closed by the peer, my application tends to
> segfault.
> 
> GDB says:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ffff6a6c710 (LWP 27005)]
> 0x00007ffff77a4db0 in pthread_mutex_lock () from /lib64/libpthread.so.0
> Missing separate debuginfos, use: debuginfo-install glibc-2.11.2-1.x86_64
> libgcc-4.4.4-10.fc12.x86_64 libid3tag-0.15.1b-9.fc12.x86_64
> libstdc++-4.4.4-10.fc12.x86_64 zlib-1.2.3-23.fc12.x86_64 (gdb) where
> #0  0x00007ffff77a4db0 in pthread_mutex_lock () from /lib64/libpthread.so.0
> #1  0x00007ffff7bd97ce in MHD_destroy_response (response=0x7ffff7ed5010) at
> response.c:341 #2  0x00007ffff7bd760f in MHD_cleanup_connections
> (daemon=0x62eb60) at daemon.c:964 #3  0x00007ffff7bd8fbc in
> MHD_select_thread (cls=0x62eb60) at daemon.c:1205 #4  0x00007ffff77a2a3a
> in start_thread () from /lib64/libpthread.so.0 #5  0x00007ffff6d6077d in
> clone () from /lib64/libc.so.6
> #6  0x0000000000000000 in ?? ()
> 
> It looks like pos->response is being "destroyed" twice. If I remove one of
> the instances, the segfault is gone.
> 
> Index: src/daemon/daemon.c
> ===================================================================
> --- src/daemon/daemon.c       (revision 12985)
> +++ src/daemon/daemon.c       (working copy)
> @@ -952,7 +952,7 @@
>                 abort();
>               }
>              }
> -          MHD_destroy_response (pos->response);
> +          // MHD_destroy_response (pos->response);
>            MHD_pool_destroy (pos->pool);
>  #if HTTPS_SUPPORT
>            if (pos->tls_session != NULL)



reply via email to

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