[mod_python] mod_python crash on MP system

Manfred Rohrmueller mrohrmueller at ra.rockwell.com
Wed Jul 13 05:16:34 EDT 2005


We have a crash similar to 
 http://www.modpython.org/pipermail/mod_python/2004-February/015004.html, 
but we still get the crash even with a very small configuration file...

The crash can be reproduced faster, if the number of
threads (ThreadsPerChild) is higher, the Apache
process priority is set to 'Realtime' or 'High' and the
number of clients is high. This crash looks similar to the one described 
in

Can anyone help with this stack trace?

Thanks in advance

  Manfred


-------------------------------------------------------------------

OS
Windows XP SP2+ Hyperthreading ON;
Windows 2003 SP1 2xXEON + Hyperthreading ON

Server: Apache/2.0.54 (Win32) mod_python/3.1.4 Python/2.3.5
Server: Apache/2.0.52 (Win32) mod_python/3.1.4 Python/2.3.5
Server: Apache/2.0.54 (Win32) mod_python/3.1.3 Python/2.3.5
Server: Apache/2.0.52 (Win32) mod_python/3.1.3 Python/2.3.5

Command line:
apache.exe -DDEBUG -DONE_PROCESS -C "DocumentRoot ..." -C "Listen 8080" -C 
"PidFile ..." -C "ServerAdmin ..." -C "ServerRoot ..." -C "ServerName ..." 
-d ... -f ... -C "PythonPath '[...]'"

-------------------------------------------------------------------
20 worker threads

Apache Threads:
        388     main    child_main      Normal  0
        2212    worker_main     apr_stat        Normal  0
        440     worker_main     apr_file_open   Normal  0
        1744    worker_main     apr_stat        Normal  0
        1556    worker_main     apr_winapi_GetFileAttributesExW Normal  0
        2116    worker_main     EnterNonRecursiveMutex  Normal  0
        172     worker_main     apr_stat        Normal  0
        2964    worker_main     EnterNonRecursiveMutex  Normal  0
        3876    worker_main     EnterNonRecursiveMutex  Normal  0
        1516    worker_main     EnterNonRecursiveMutex  Normal  0
        4044    worker_main     EnterNonRecursiveMutex  Normal  0
        1552    worker_main     EnterNonRecursiveMutex  Normal  0
        3604    worker_main     EnterNonRecursiveMutex  Normal  0
        1728    worker_main     EnterNonRecursiveMutex  Normal  0
        2848    worker_main     apr_file_flush  Normal  0
        3784    worker_main     EnterNonRecursiveMutex  Normal  0
        3860    worker_main     EnterNonRecursiveMutex  Normal  0
        3816    worker_main     EnterNonRecursiveMutex  Normal  0
        2036    worker_main     EnterNonRecursiveMutex  Normal  0
        1780    worker_main     EnterNonRecursiveMutex  Normal  0
>       3468    worker_main     __ascii_stricmp Normal  0
        1292    winnt_accept    winnt_accept    Normal  0

-------------------------------------------------------------------
Stack:
>       msvcr71.dll!__ascii_stricmp(void * dst=0x68747950, void * 
src=0x4c27725b)  Line 79        Asm
        msvcr71.dll!_stricmp(const char * dst=0x68747950, const char * 
src=0x4c27725b)  Line 57 + 0xb  C
        libapr.dll!table_mergesort(apr_pool_t * pool=0x68747950, 
apr_table_entry_t * * values=0x00000001, int n=0x00000003)  Line 975 + 
0x11    C
        libapr.dll!apr_table_compress(apr_table_t * t=0x008e7148, unsigned 
int flags=0x00000000)  Line 1092        C
        libapr.dll!apr_table_overlap(apr_table_t * a=0x008e7148, const 
apr_table_t * b=0x008b12b8, unsigned int flags=0x00000000)  Line 1206 + 
0xe     C
        mod_python.so!python_merge_config(apr_pool_t * p=0x008e61b8, void 
* current_conf=0x0087f3c8, void * new_conf=0x008b1150)  Line 618        C
        libhttpd.dll!ap_merge_per_dir_configs(apr_pool_t * p=0x008e61b8, 
ap_conf_vector_t * base=0x008734b8, ap_conf_vector_t * 
new_conf=0x008b0e38)  Line 241 + 0x5    C
        libhttpd.dll!ap_location_walk(request_rec * r=0x008e61f0)  Line 
1290 + 0x11     C
        libhttpd.dll!ap_process_request_internal(request_rec * 
r=0x00000000)  Line 136 + 0x6   C
        libhttpd.dll!ap_process_request(request_rec * r=0x008e61f0)  Line 
248     C
        libhttpd.dll!ap_process_http_connection(conn_rec * c=0x008e22b0) 
Line 251 + 0x6  C
        libhttpd.dll!ap_run_process_connection(conn_rec * c=0x008e22b0) 
Line 43 + 0x25  C
        libhttpd.dll!ap_process_connection(conn_rec * c=0x008e22b0, void * 
csd=0x008e21e0)  Line 176 + 0x6 C
        libhttpd.dll!worker_main(void * thread_num_val=0x008e22a8)  Line 
733     C
        msvcr71.dll!_threadstartex(void * ptd=0x003039d8)  Line 241 + 0x6 
C
        kernel32.dll!GetModuleFileNameA()  + 0x1b4

-------------------------------------------------------------------
Test script (crash_apache.py):
# begin: crash_apache.py
#! sessions  have to coresponde to the (ThreadsPerChild/number of clients)
sessions=10

import urllib, threading

class getu(threading.Thread):
  def __init__(self, nom):
    self.nom = nom
    threading.Thread.__init__(self)
  def run(self):
    for i in range(10000):
      rr = urllib.urlopen("http://localhost:8080/test/thread_%s_%s.pd" % (self.nom, i))
      rr.readlines()
      rr.close()

threads = [getu(i) for i in range(sessions)]

def c ():
  [t.start() for t in threads]
  [t.join() for t in threads]

"""
import crash_apache
crash_apache.c()
"""
# end: crash_apache.py

-------------------------------------------------------------------
Test handler (mptest.py):

from mod_python import apache
requestCount = 0
rsp = "<html><body>#[%s]</body></html>"
def handler(apacheRequest):
  global requestCount
  apache.log_error( "Request #%d" % requestCount )
  requestCount += 1
  apacheRequest.write( rsp% requestCount)
  apacheRequest.flush()
  return apache.OK


-------------------------------------------------------------------
Stripped HTTP config: (comments removed)

Timeout 300
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 90

<IfModule mpm_winnt.c>
ThreadsPerChild 20
MaxRequestsPerChild  0
</IfModule>

LoadModule alias_module modules/mod_alias.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule python_module modules/mod_python.so


<Directory "/">
</Directory>

DefaultType text/plain
HostnameLookups Off
LogLevel error

PythonImport mptest main_interpreter
<LocationMatch "/test/.*\.pd">
  SetHandler python-program
  PythonHandler mptest::handler
  PythonEnablePdb Off
  PythonDebug On
  PythonAutoReload Off
  PythonInterpPerDirectory Off
  PythonInterpreter main_interpreter
</LocationMatch>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050713/3da6a980/attachment-0001.html


More information about the Mod_python mailing list