You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/10/08 21:12:54 UTC

DO NOT REPLY [Bug 13419] New: - Weird seg fault on Mac OS X for mod_jk2 + Apache2

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13419>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13419

Weird seg fault on Mac OS X for mod_jk2 + Apache2

           Summary: Weird seg fault on Mac OS X for mod_jk2 + Apache2
           Product: Tomcat 4
           Version: 4.1.12
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Coyote JK 2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: hanming@apple.com


I configured Apache 2.0.42, Tomcat 4.1.12 and downloaded
jakarta-tomcat-connectors-4.1.12-src. I managed to use GNU's libtoolize to
configure (./configure --with-apxs2=/usr/local/apache2/bin/apxs
--with-apr-lib=/usr/local/apache2/lib
--with-apr-include=/usr/local/apache2/include
--with-tomcat1=/usr/local/jakarta-tomcat-4.1.12).

The compilation was successful and I copied mod_jk2.so to 
/usr/local/apache2/modules. I configured httpd.conf to load the module and
appended the following:

<IfModule mod_jk2.c>
JkSet "config.file" "/usr/local/apache2/conf/workers2.properties"
</IfModule>

I added a super simple workers2.properties file in the same dir and tried
to start apache. I got a seg fault. Here's the stacktrace from Mac OS X
default crash logger:

Thread 0 Crashed:
 #0   0x90001600 in strlen
 #1   0x900023e0 in vfprintf
 #2   0x900017ec in fprintf
 #3   0x0061dd18 in jk2_map_default_get (jk_map.c:104) <- see codes below for the statement
 #4   0x0061bbb4 in jk2_env_getBean2 (jk_env.c:423)      
 #5   0x0061af40 in jk2_env_createBean2 (jk_env.c:218)
 #6   0x00636754 in jk2_create_config (mod_jk2.c:344)
 #7   0x0002214c in ap_single_module_configure (config.c:1845)

I'm adding my own printf's. For completeness, here's the function

static void *jk2_map_default_get(jk_env_t *env, jk_map_t *m,
                                 const char *name)
{
    int i;
    jk_map_private_t *mPriv;
    void *result=NULL;

    if(name==NULL )
        return NULL;
    fprintf(stdout, "\nentering for %s ", name);

    mPriv=(jk_map_private_t *)m->_private;

    fprintf(stdout, " (no. maps: %d)\n", mPriv->size);
    for(i = 0 ; i < mPriv->size ; i++) {
      fprintf(stdout, "\t%d: ", i);

      if ((mPriv->names[i]) == NULL) {
        fprintf(stdout, "null mPriv->names[]");
        return NULL;
      }

      fprintf(stdout, " %p ", &(mPriv->names[i]));
      fflush(stdout);
      fprintf(stdout, " %s ", mPriv->names[i]); /* this is line 104 */
      fprintf(stdout, " (%p) \n", mPriv->values[i]);

      if(0 == strcmp(mPriv->names[i], name)) {
        result = mPriv->values[i];
        break;
      }
    }
    fprintf(stdout, "done for %s\n", name);
    return result;
}

And as per requested by Costin, I added the printf in the put function:
	...
    if(mPriv->size < mPriv->capacity) {
        mPriv->values[mPriv->size] = value;
        /* XXX this is wrong - either we take ownership and copy both
           name and value,
           or none. The caller should do that if he needs !
           Sure, but we should have our copy...
        mPriv->names[mPriv->size] =  (char *)name;
        */
        mPriv->names[mPriv->size] = m->pool->pstrdup(env,m->pool, name);
        printf("put '%s' (addr: %p) with value: %p \n", mPriv->names[mPriv->size], &(mPriv->names[mPriv->size]), value);
        mPriv->size ++;
        rc = JK_OK;
    }
    ...


And finally, here's the output:

put 'logger.file' (addr: 0x19b948) with value: 0x61d984
put 'logger.win32' (addr: 0x19b94c) with value: 0x61dac8
put 'workerEnv' (addr: 0x19b950) with value: 0x62c698
put 'uriMap' (addr: 0x19b954) with value: 0x62a3d4
put 'uriEnv' (addr: 0x19b958) with value: 0x627fa4
put 'endpoint' (addr: 0x19b95c) with value: 0x61a65c
put 'uri' (addr: 0x19b960) with value: 0x627fa4
put 'config' (addr: 0x19b964) with value: 0x61a028
put 'ajp13' (addr: 0x19b968) with value: 0x62f168
put 'lb' (addr: 0x19b96c) with value: 0x6308dc
put 'status' (addr: 0x19b970) with value: 0x632c2c
put 'run' (addr: 0x19b974) with value: 0x630d60
put 'channel.un' (addr: 0x19b978) with value: 0x617dc8
put 'channel.apr' (addr: 0x19b97c) with value: 0x615644
put 'shm' (addr: 0x19b980) with value: 0x626ee8
put 'channel.socket' (addr: 0x19b984) with value: 0x616c64
put 'handler.response' (addr: 0x19b988) with value: 0x61cff0
put 'handler.logon' (addr: 0x19b98c) with value: 0x61c578
put 'threadMutex' (addr: 0x19b990) with value: 0x620da8
put 'procMutex' (addr: 0x19b994) with value: 0x6209fc
put 'channel.jni' (addr: 0x19b998) with value: 0x6157b0
put 'worker.jni' (addr: 0x19b99c) with value: 0x62f3f4
put 'vm' (addr: 0x19b9a0) with value: 0x62a864
put 'signal' (addr: 0x19b9a4) with value: 0x627038
put 'user' (addr: 0x19b9a8) with value: 0x62a7a8

entering for threadMutex  (no. maps: 25)
	0:  0x19b948  logger.file  (0x61d984)
	1:  0x19b94c  logger.win32  (0x61dac8)
	2:  0x19b950  workerEnv  (0x62c698)
	3:  0x19b954  uriMap  (0x62a3d4)
	4:  0x19b958  uriEnv  (0x627fa4)
	5:  0x19b95c  endpoint  (0x61a65c)
	6:  0x19b960  uri  (0x627fa4)
	7:  0x19b964  config  (0x61a028)
	8:  0x19b968  ajp13  (0x62f168)
	9:  0x19b96c  lb  (0x6308dc)
	10:  0x19b970  status  (0x632c2c)
	11:  0x19b974  run  (0x630d60)
	12:  0x19b978  channel.un  (0x617dc8)
	13:  0x19b97c  channel.apr  (0x615644)
	14:  0x19b980  shm  (0x626ee8)
	15:  0x19b984  channel.socket  (0x616c64)
	16:  0x19b988  handler.response  (0x61cff0)
	17:  0x19b98c  handler.logon  (0x61c578)
	18:  0x19b990  threadMutex  (0x620da8)
done for threadMutex
put 'threadMutex:0' (addr: 0x19eea8) with value: 0x52e080
put 'logger.apache2' (addr: 0x19b9ac) with value: 0x63447c

...[snip]
...[snip]

entering for workerEnv  (no. maps: 19)
	0:  0x19eea8  threadMutex:0  (0x52e080)
	1:  0x19eeac  logger.apache2:  (0x532090)
	2:  0x19eeb0  logger.apache2  (0x532090)
	3:  0x19eeb4  logger  (0x532090)
	4:  0x19eeb8  uriMap:  (0x5360a8)
	5:  0x19eebc  uriMap  (0x5360a8)
	6:  0x19eec0  config:  (0x5380b8)
	7:  0x19eec4  config  (0x5380b8)
	8:  0x19eec8  shm:  (0x53a0c8)
	9:  0x19eecc  shm  (0x53a0c8)
	10:  0x19eed0  workerEnv:  (0x5340a0)
	11:  0x19eed4  workerEnv  (0x5340a0)
done for workerEnv
put '/examples/*' (addr: 0x5361cc) with value: 0x55a520
put 'uri:/examples/*' (addr: 0x19eef4) with value: 0x558520

entering for ver  (no. maps: 1)
	0:  0x19c618  worker  (0x19c600)
done for ver
put 'worker' (addr: 0x538b20) with value: 0x538ac8
put 'uri:/examples/*.worker' (addr: 0x53423c) with value: 0x538ac8

entering for uri:  (no. maps: 20)
	0:  0x19eea8

bin/apachectl: line 87:   3243 Segmentation fault      $HTTPD -k $ARGV

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>