apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48084] New: Erasing HTTPD library global variables before reinitialize server
Date Thu, 29 Oct 2009 15:11:51 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=48084

           Summary: Erasing HTTPD library global variables before
                    reinitialize server
           Product: APR
           Version: 1.3.9
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: ishay.lavi@audiocodes.com


I use:
------
HTTPD version: httpd-2.2.13-win32-src
Platform: Windows, build with VC2005



I build my application vs. libhttpd (Apache) library  (for adding HTTP server
abilities), during application running it required to shutting down and then
(after some time) to start this (HTTP) server again.
The procedure I used to initialize/shutting down this server is same as used in
the Apache httpd project “main.c” file with one difference, I set back the
'apr_app_init_complete' (defined at 'start.c' file) global variable (again
'erasing global variables' issue) to zero (cause server to read again the CLI
'argc'/'argv' argument).

The problem occur in the 2nd  running, exception occur.
I debug it and I see that this issue caused by global (static) variables that
initialized and doesn’t erased after 1st server running.

Specifically I saw it for the ‘hooks’ ( “static struct { members } _hooks;”)
global variable that defined at the ‘apr_hooks.h’ file, for the 1st running
it’s fields set to ‘NULL’ value, but at 2nd it keep illegal addresses from the
1st running.



Location for this acceptation:
          APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr)
          {
here==>       if (arr->nelts == arr->nalloc) {
                  int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2;
                  char *new_data;

                  new_data = apr_palloc(arr->pool, arr->elt_size * new_size);
          .
          .
          .
          }


Call Stack for this exception:
>	libapr-1.dll!apr_array_push(apr_array_header_t * arr=0x046299c0)  Line 109 + 0x6 bytes
C
     libhttpd.dll!ap_hook_create_connection(conn_rec * (apr_pool_t *,
server_rec *, apr_socket_t *, long, void *, apr_bucket_alloc_t *)*
pf=0x6ff0c430, const char * const * aszPre=0x00000000, const char * const *
aszSucc=0x00000000, int nOrder=30)  Line 42 + 0x41 bytes    C
     libhttpd.dll!register_hooks(apr_pool_t * p=0x043905b0)  Line 3988    C
     libhttpd.dll!ap_register_hooks(module_struct * m=0x6ff47928, apr_pool_t *
p=0x043905b0)  Line 427 + 0xc bytes    C
     libhttpd.dll!ap_add_module(module_struct * m=0x6ff47928, apr_pool_t *
p=0x043905b0)  Line 554    C
     libhttpd.dll!ap_setup_prelinked_modules(process_rec * process=0x0438f5c8) 
Line 697 + 0x12 bytes    C


NOTE: The called to apr_array_push() procedure added using the
'APR_IMPLEMENT_EXTERNAL_HOOK_BASE' macro (defined at 'apr_hooks.h' file).
/** macro to implement the hook */
#define APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \
link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf,const char *
const *aszPre, \
                                      const char * const *aszSucc,int nOrder) \
    { \
    ns##_LINK_##name##_t *pHook; \
    if(!_hooks.link_##name) \
    { \
   
_hooks.link_##name=apr_array_make(apr_hook_global_pool,1,sizeof(ns##_LINK_##name##_t));
\
    apr_hook_sort_register(#name,&_hooks.link_##name); \
    } \
    pHook=apr_array_push(_hooks.link_##name); \ .
.
.
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message