ralphjzhang / openpgm

Automatically exported from code.google.com/p/openpgm
0 stars 0 forks source link

http.c needs to #include <config.h> to use the configured lock type #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I built libpgm 5.2.122 on Ubuntu 12.10 x86_64 with this command:

        cons WITH_HTTP=true BUILD=debug

I modified the purinrecv.c example to call pgm_http_init just after pgm_init:

        if (!pgm_http_init (PGM_HTTP_DEFAULT_SERVER_PORT, &pgm_err)) {
                fprintf (stderr, "Unable to start PGM http: %s\n", pgm_err->message);
                pgm_error_free (pgm_err);
                return EXIT_FAILURE;
        }

When I go to http://localhost:4968 in my browser, the http thread hangs on the 
call to 
pgm_rwlock_reader_lock (&pgm_sock_list_lock) in index_callback.

After some debugging, I realized my config.h contains #define 
USE_DUMB_RWSPINLOCK 1.  This causes engine.c to initialize pgm_sock_list_lock 
as a spinlock (pgm_rwspinlock_init).  

But http.c does not include config.h, so USE_DUMB_RWSPINLOCK is not defined 
with http.c is compiled.  So the call to pgm_rwlock_reader_lock 
(&pgm_sock_list_lock) from http.c calls pthread_rwlock_rdlock, which does not 
work on the spinlock.

Adding #include <config.h> to the top of http.c fixes this.  I'm attaching my 
modified version of http.c

Original issue reported on code.google.com by aaron.ri...@gmail.com on 9 Feb 2013 at 1:44

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, side effect of autoconf changes and the http & snmp interfaces not 
being supported components and thus not tested in every release.

Original comment by fnjo...@gmail.com on 10 Feb 2013 at 9:23

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1494.

Original comment by fnjo...@gmail.com on 10 Feb 2013 at 9:46

GoogleCodeExporter commented 9 years ago
Also applies to the MIB code for SNMP (pgmMIB.c).  Merged into revision 1494.

Original comment by fnjo...@gmail.com on 10 Feb 2013 at 9:47