You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Han Ming Ong <ha...@apple.com> on 2002/10/03 03:03:14 UTC

Weird seg fault on Mac OS X for mod_jk2 + Apache2

Folks,
	I'm trying to trace down a TCP_NODELAY problem and wanted to see if it 
exists on the latest connector mod_jk2. So 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:

Command:    httpd
PID:        853

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x736f0028

Thread 0 Crashed:
  #0   0x90001600 in strlen
  #1   0x900023e0 in vfprintf
  #2   0x90015ee0 in __sbprintf
  #3   0x900018a8 in vfprintf
  #4   0x900017ec in fprintf
  #5   0x0060fdbc in jk2_map_default_get (jk_map.c:97)  <-- it's '97' 
because I added printf
  #6   0x0060df50 in jk2_env_createBean2 (jk_env.c:218)
  #7   0x0061ee0c in jk2_create_config (mod_jk2.c:351)
  #8   0x0002214c in ap_single_module_configure (config.c:1845)
  #9   0x00007ad8 in load_module (mod_so.c:337)
  #10  0x00020308 in invoke_cmd (config.c:749)
  #11  0x000213d0 in execute_now (config.c:1347)
  #12  0x00020a40 in ap_build_config_sub (config.c:944)
  #13  0x00020f68 in ap_build_config (config.c:1151)
  #14  0x000218f0 in ap_process_resource_config (config.c:1556)
  #15  0x000220e8 in ap_read_config (config.c:1834)
  #16  0x0000c184 in main (main.c:615)
  #17  0x00001ae0 in _start (crt.c:267)
  #18  0x00001960 in start


Here's output with some printf statements inserted in jk_map.c:
entering for threadMutex  (no. maps: 25)
         0:  logger.file (°Z°Z°Z°Z°Z°Z) <- funny output is from 
fprintf(stderr,"%s", mPriv->values[i])
         1:  logger.win32 (°Z°Z°Z°Z°Z)
         2:  workerEnv (°Z°ZA°Z°Z)
         3:  uriMap (°Z°Za°Z°Z)
         4:  uriEnv (°Z°ZA°Z°Z)
         5:  endpoint (°Z°ZA°Z°Z)
         6:  uri (°Z°ZA°Z°Z)
         7:  config (°Z°Z°Z°Z°Z°Z)
         8:  ajp13 (°Z°ZA°Z°Z)
         9:  lb (,)
         10:  status (°Z°Z°Z°Z°Z)
         11:  run (,)
         12:  channel.un (°Z°ZA°Z°Z)
         13:  channel.apr (°Z°ZA°Z°Z)
         14:  shm (°Z°Z°Z°Z°Z°Z)
         15:  channel.socket (°Z°ZA°Z°Z)
         16:  handler.response (°Z°Z°Z°Z°Z°Z)
         17:  handler.logon (°Z°Z°Z°Z°Z°Z)
         18:  threadMutex (°Z°Z°Z°Z°Z°Z)
done for threadMutex
entering for logger.apache2:  (no. maps: 1)
         0:  threadMutex:0 ()
done for logger.apache2:
...
...
entering for uri:/examples/*  (no. maps: 19)
         0:  threadMutex:0 ()
         1:  logger.apache2: ()
         2:  logger.apache2 ()
         3:  logger ()
         4:  uriMap: ()
         5:  uriMap ()
         6:  config: ()
         7:  config ()
         8:  shm: ()
         9:  shm ()
         10:  workerEnv: ()
         11:  workerEnv ()
         12:  uri: ()
         13:  uri ()
         14:  threadMutex:1 ()
         15:  threadMutex:2 ()
         16:  threadMutex:3 ()
         17:  ajp13:localhost:8009 ()
         18:  channel.socket:localhost:8009 ()
done for uri:/examples/*
entering for uri  (no. maps: 26)
         0:  logger.file (°Z°Z°Z°Z°Z°Z)
         1:  logger.win32 (°Z°Z°Z°Z°Z)
         2:  workerEnv (°Z°ZA°Z°Z)
         3:  uriMap (°Z°Za°Z°Z)
         4:  uriEnv (°Z°ZA°Z°Z)
         5:  endpoint (°Z°ZA°Z°Z)
         6:  uri (°Z°ZA°Z°Z)
done for uri
entering for workerEnv  (no. maps: 19)
         0:  threadMutex:0 ()
         1:  logger.apache2: ()
         2:  logger.apache2 ()
         3:  logger ()
         4:  uriMap: ()
         5:  uriMap ()
         6:  config: ()
         7:  config ()
         8:  shm: ()
         9:  shm ()
         10:  workerEnv: ()
         11:  workerEnv ()
done for workerEnv
entering for ver  (no. maps: 1)
         0:  worker (ajp13:localhost:8009)
done for ver
[here it churns for a few seconds before segfaulting]
bin/apachectl: line 87:   853 Segmentation fault      $HTTPD -k $ARGV

	Anyone has a clue on what could be wrong? Just pointers would help. I 
tried following the stack trace but am temporarily thrown off by how 
jk2_env_createBean2() gets to jk2_map_default_get(), especially the 
second parameter's type. It seems to be casted from (char *) to 
(jk_map_t *), which is kind of weird.

	Appreciate it.

Han Ming


#------------------------ workers2.properties 
--------------------------------

# Shared memory handling. Needs to be set.
[shm]
file=/usr/local/apache2/logs/shm.file
size=1048576

# Example socket channel, explicitly set port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
#keepalive=1

# define the worker
[ajp13:localhost:8009]
#        channel=channel.un:/usr/local/tomcat/work/jk2.socket
# To use the TCP/IP socket instead, just comment out the above
# line, and uncomment the one below
channel=channel.socket:localhost:8009

# Announce a "status" worker
[status:status]

# Uri mapping
[uri:/examples/*]
worker=ajp13:localhost:8009
#worker=ajp13:/usr/local/tomcat/work/jk2.socket

[uri:/jkstatus/*]
worker=status:status

#---- end of workers2.properties
  
  

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


Re: Weird seg fault on Mac OS X for mod_jk2 + Apache2

Posted by Costin Manolache <cm...@yahoo.com>.
Han Ming Ong wrote:

> 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:
> 
> Command:    httpd
> PID:        853
> 
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x736f0028
> 
> Thread 0 Crashed:
>   #0   0x90001600 in strlen
>   #1   0x900023e0 in vfprintf
>   #2   0x90015ee0 in __sbprintf
>   #3   0x900018a8 in vfprintf
>   #4   0x900017ec in fprintf
>   #5   0x0060fdbc in jk2_map_default_get (jk_map.c:97)  <-- it's '97'
> because I added printf

Are you using the commented-out printf ? It is possible that 
one of name or value is null - printf is not checking for null on
many OS. Try using apr printf, or check for null.


> Here's output with some printf statements inserted in jk_map.c:
> entering for threadMutex  (no. maps: 25)
>          0:  logger.file (°Z°Z°Z°Z°Z°Z) <- funny output is from
> fprintf(stderr,"%s", mPriv->values[i])

Can you add printf to map_put also ? 

The value in this case is the jk_env structure ( or jk_log ?), it's
normal to be 'funny'. I would print it as %p, it's a struct *.
( at least for the object map )


> entering for ver  (no. maps: 1)
>          0:  worker (ajp13:localhost:8009)
> done for ver
> [here it churns for a few seconds before segfaulting]
> bin/apachectl: line 87:   853 Segmentation fault      $HTTPD -k $ARGV
> 
> Anyone has a clue on what could be wrong? Just pointers would help. I
> tried following the stack trace but am temporarily thrown off by how
> jk2_env_createBean2() gets to jk2_map_default_get(), especially the
> second parameter's type. It seems to be casted from (char *) to
> (jk_map_t *), which is kind of weird.

Not sure what you mean. The second parameter of env->getBean2( ) is
string. jk2_env_getBean2 will call jk2_map_default_get ( actually,
env->_objects->get ) with env->_objects as second param, which is
a jk_map.

Please check first the printf() params for null.

Costin

> 
> Appreciate it.
> 
> Han Ming
> 
> 
> #------------------------ workers2.properties
> --------------------------------
> 
> # Shared memory handling. Needs to be set.
> [shm]
> file=/usr/local/apache2/logs/shm.file
> size=1048576
> 
> # Example socket channel, explicitly set port and host.
> [channel.socket:localhost:8009]
> port=8009
> host=127.0.0.1
> #keepalive=1
> 
> # define the worker
> [ajp13:localhost:8009]
> #        channel=channel.un:/usr/local/tomcat/work/jk2.socket
> # To use the TCP/IP socket instead, just comment out the above
> # line, and uncomment the one below
> channel=channel.socket:localhost:8009
> 
> # Announce a "status" worker
> [status:status]
> 
> # Uri mapping
> [uri:/examples/*]
> worker=ajp13:localhost:8009
> #worker=ajp13:/usr/local/tomcat/work/jk2.socket
> 
> [uri:/jkstatus/*]
> worker=status:status
> 
> #---- end of workers2.properties

-- 
Costin



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


Re: Weird seg fault on Mac OS X for mod_jk2 + Apache2

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Han Ming Ong wrote:
> Folks,
>     I'm trying to trace down a TCP_NODELAY problem and wanted to see if 
> it exists on the latest connector mod_jk2. So 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:
> 
> Command:    httpd
> PID:        853
> 
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x736f0028
> 
> Thread 0 Crashed:
>  #0   0x90001600 in strlen
>  #1   0x900023e0 in vfprintf
>  #2   0x90015ee0 in __sbprintf
>  #3   0x900018a8 in vfprintf
>  #4   0x900017ec in fprintf
>  #5   0x0060fdbc in jk2_map_default_get (jk_map.c:97)  <-- it's '97' 
> because I added printf
>  #6   0x0060df50 in jk2_env_createBean2 (jk_env.c:218)
>  #7   0x0061ee0c in jk2_create_config (mod_jk2.c:351)
>  #8   0x0002214c in ap_single_module_configure (config.c:1845)
>  #9   0x00007ad8 in load_module (mod_so.c:337)
>  #10  0x00020308 in invoke_cmd (config.c:749)
>  #11  0x000213d0 in execute_now (config.c:1347)
>  #12  0x00020a40 in ap_build_config_sub (config.c:944)
>  #13  0x00020f68 in ap_build_config (config.c:1151)
>  #14  0x000218f0 in ap_process_resource_config (config.c:1556)
>  #15  0x000220e8 in ap_read_config (config.c:1834)
>  #16  0x0000c184 in main (main.c:615)
>  #17  0x00001ae0 in _start (crt.c:267)
>  #18  0x00001960 in start
> 
> 
> Here's output with some printf statements inserted in jk_map.c:
> entering for threadMutex  (no. maps: 25)
>         0:  logger.file (°Z°Z°Z°Z°Z°Z) <- funny output is from 
> fprintf(stderr,"%s", mPriv->values[i])
>         1:  logger.win32 (°Z°Z°Z°Z°Z)
>         2:  workerEnv (°Z°ZA°Z°Z)
>         3:  uriMap (°Z°Za°Z°Z)
>         4:  uriEnv (°Z°ZA°Z°Z)
>         5:  endpoint (°Z°ZA°Z°Z)
>         6:  uri (°Z°ZA°Z°Z)
>         7:  config (°Z°Z°Z°Z°Z°Z)
>         8:  ajp13 (°Z°ZA°Z°Z)
>         9:  lb (,)
>         10:  status (°Z°Z°Z°Z°Z)
>         11:  run (,)
>         12:  channel.un (°Z°ZA°Z°Z)
>         13:  channel.apr (°Z°ZA°Z°Z)
>         14:  shm (°Z°Z°Z°Z°Z°Z)
>         15:  channel.socket (°Z°ZA°Z°Z)
>         16:  handler.response (°Z°Z°Z°Z°Z°Z)
>         17:  handler.logon (°Z°Z°Z°Z°Z°Z)
>         18:  threadMutex (°Z°Z°Z°Z°Z°Z)
> done for threadMutex
> entering for logger.apache2:  (no. maps: 1)
>         0:  threadMutex:0 ()
> done for logger.apache2:
> ...
> ...
> entering for uri:/examples/*  (no. maps: 19)
>         0:  threadMutex:0 ()
>         1:  logger.apache2: ()
>         2:  logger.apache2 ()
>         3:  logger ()
>         4:  uriMap: ()
>         5:  uriMap ()
>         6:  config: ()
>         7:  config ()
>         8:  shm: ()
>         9:  shm ()
>         10:  workerEnv: ()
>         11:  workerEnv ()
>         12:  uri: ()
>         13:  uri ()
>         14:  threadMutex:1 ()
>         15:  threadMutex:2 ()
>         16:  threadMutex:3 ()
>         17:  ajp13:localhost:8009 ()
>         18:  channel.socket:localhost:8009 ()
> done for uri:/examples/*
> entering for uri  (no. maps: 26)
>         0:  logger.file (°Z°Z°Z°Z°Z°Z)
>         1:  logger.win32 (°Z°Z°Z°Z°Z)
>         2:  workerEnv (°Z°ZA°Z°Z)
>         3:  uriMap (°Z°Za°Z°Z)
>         4:  uriEnv (°Z°ZA°Z°Z)
>         5:  endpoint (°Z°ZA°Z°Z)
>         6:  uri (°Z°ZA°Z°Z)
> done for uri
> entering for workerEnv  (no. maps: 19)
>         0:  threadMutex:0 ()
>         1:  logger.apache2: ()
>         2:  logger.apache2 ()
>         3:  logger ()
>         4:  uriMap: ()
>         5:  uriMap ()
>         6:  config: ()
>         7:  config ()
>         8:  shm: ()
>         9:  shm ()
>         10:  workerEnv: ()
>         11:  workerEnv ()
> done for workerEnv
> entering for ver  (no. maps: 1)
>         0:  worker (ajp13:localhost:8009)
> done for ver
> [here it churns for a few seconds before segfaulting]
> bin/apachectl: line 87:   853 Segmentation fault      $HTTPD -k $ARGV
> 
>     Anyone has a clue on what could be wrong? Just pointers would help. 
> I tried following the stack trace but am temporarily thrown off by how 
> jk2_env_createBean2() gets to jk2_map_default_get(), especially the 
> second parameter's type. It seems to be casted from (char *) to 
> (jk_map_t *), which is kind of weird.

mPriv is NULL or wrongly align.

> 
>     Appreciate it.
> 
> Han Ming
> 
> 
> #------------------------ workers2.properties 
> --------------------------------
> 
> # Shared memory handling. Needs to be set.
> [shm]
> file=/usr/local/apache2/logs/shm.file
> size=1048576
> 
> # Example socket channel, explicitly set port and host.
> [channel.socket:localhost:8009]
> port=8009
> host=127.0.0.1
> #keepalive=1
> 
> # define the worker
> [ajp13:localhost:8009]
> #        channel=channel.un:/usr/local/tomcat/work/jk2.socket
> # To use the TCP/IP socket instead, just comment out the above
> # line, and uncomment the one below
> channel=channel.socket:localhost:8009
> 
> # Announce a "status" worker
> [status:status]
> 
> # Uri mapping
> [uri:/examples/*]
> worker=ajp13:localhost:8009
> #worker=ajp13:/usr/local/tomcat/work/jk2.socket
> 
> [uri:/jkstatus/*]
> worker=status:status
> 
> #---- end of workers2.properties
>  
>  
> 
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 




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