I've this strange behavior in Apache publish_config handler :

int setup_module(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s)
{
    //1
    my_config_t *config =  ap_get_module_config(s->module_config, &my_module);

    //2
    log_me(config->logfp, apr_psprintf(ptemp, "My module version %s\n", MY_VERSION));

    //3
    log_me(config->logfp, "Starting the batch job");

    return OK;
}

log_me is really a custom function declared in another file and declared within the header (it's resolved at compile time).

Within the step2 I can tell that config includes a valid value, however step three fails having a SEGSEGV and when I attempt to debug it I can tell this :

//step two gdb: print config $1 = (my_config_t *)0x7a8098

//step three gdb: print config Cannot access memory at address 0x38

Something is overwriting the config pointer. Are you able to put a breakpoint around the memory location and find out what's performing the overwrite? Here's helpful tips for how to get this done: http://www.technochakra.com/debugging-types-of-data-breakpoints-in-gdb/

What's ptemp passed into setup_module, and it is it dependable it as being a buffer for the sprintf? Is it feasible ptemp indicates a memory area that is not big enough to carry that string?

Perhaps you should declare a car variable (char buffer[80];) and employ that for the sprintf?

I have found teh problem.

In log_me I had been making :

int nbytes = strlen(message)

rather than:

apr_size_t nbytes = strlen(message)

Standing on 64 bits this screwed all.. no clue why yet.