[mod_python] 3.1.2b InputFilter SegFault (w/Backtrace)

Daniel West dwmp at opti.cgi.net
Sun Jan 11 02:09:37 EST 2004

While setting up an InputFilter I ran across a segfault in 3.1.2b.  I 
created an InputFilter to add a few members to the request object 
(filter.req) before the request is sent to the handler and 
OutputFilter.  When run, the InputFilter is processed but the new members 
it adds to the request object are not to be found in the subsequent handler 
or output filter.  After receiving a traceback (PythonDebug On) for trying 
to access non-existent members of the request object the server process 
proceeds to segfault.  Other than setting a few new members to the request 
object, the input filter just calls filter.pass_on().

Extra info: "virtualhost.com" is the virtual host I'm working with.  When 
other virtual hosts are listed before my virtual host, I get their name in 
the second line of the backtrace instead of "virtualhost.com" even though 
the request was made to "virtualhost.com".

The system is Linux 2.4, Apache 2.0.48, and Python 2.3.2.  Apache is 
compiled with the worker_mpm.  Please let me know if there is any other 
information I can provide.

(gdb) r
Starting program: /usr/local/apache2/bin/httpd -DONE_PROCESS
[New Thread 1024 (LWP 7082)]
[New Thread 2049 (LWP 7084)]
[New Thread 1026 (LWP 7085)]
[New Thread 2051 (LWP 7086)]
[New Thread 3076 (LWP 7087)]
[New Thread 4101 (LWP 7088)]
[New Thread 5126 (LWP 7089)]
[New Thread 6151 (LWP 7090)]
[New Thread 7176 (LWP 7091)]
[New Thread 8201 (LWP 7092)]
[New Thread 9226 (LWP 7093)]
[New Thread 10251 (LWP 7094)]
[New Thread 11276 (LWP 7095)]
[New Thread 12301 (LWP 7096)]
[New Thread 13326 (LWP 7097)]
[New Thread 14351 (LWP 7098)]
[New Thread 15376 (LWP 7099)]
[New Thread 16401 (LWP 7100)]
[New Thread 17426 (LWP 7101)]
[New Thread 18451 (LWP 7102)]
[New Thread 19476 (LWP 7103)]
[New Thread 20501 (LWP 7104)]
[New Thread 21526 (LWP 7105)]
[New Thread 22551 (LWP 7106)]
[New Thread 23576 (LWP 7107)]
[New Thread 24601 (LWP 7108)]
[New Thread 25626 (LWP 7109)]
[New Thread 26651 (LWP 7110)]
[New Thread 27676 (LWP 7111)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2051 (LWP 7086)]
ap_add_cgi_vars (r=0x81f3fd8) at util_script.c:390
390         if (!strcmp(r->protocol, "INCLUDED")) {
(gdb) bt
#0  ap_add_cgi_vars (r=0x81f3fd8) at util_script.c:390
#1  0x401f488a in get_request_object (req=0x81f3fd8, interp_name=0x8127298 
     phase=0x40289a8e "PythonInputFilter") at mod_python.c:862
#2  0x401f50cc in python_filter (is_input=1, f=0x81f5708, bb=0x81f4c68, 
     block=APR_BLOCK_READ, readbytes=0) at mod_python.c:1338
#3  0x401f5190 in python_input_filter (f=0x81f5708, bb=0x81f4c68, 
     readbytes=0) at mod_python.c:1383
#4  0x0809024e in ap_get_brigade (next=0x81f5708, bb=0x81f4c68, 
     readbytes=0) at util_filter.c:514
#5  0x0809024e in ap_get_brigade (next=0x81f4c08, bb=0x81f4c68, 
     readbytes=0) at util_filter.c:514
#6  0x0809104b in ap_rgetline_core (s=0x81f3ff0, n=8192, read=0x40844958, 
r=0x81f3fd8, fold=0, bb=0x81f4c68)
     at protocol.c:256
#7  0x0809150d in read_request_line (r=0x81f3fd8, bb=0x81f4c68) at 
#8  0x08091a8f in ap_read_request (conn=0x81ee0b0) at protocol.c:900
#9  0x08069940 in ap_process_http_connection (c=0x81ee0b0) at http_core.c:312
#10 0x0808e742 in ap_run_process_connection (c=0x81ee0b0) at connection.c:85
#11 0x08082c22 in process_socket (p=0x81edf88, sock=0x81edfc0, 
my_child_num=0, my_thread_num=0,
     bucket_alloc=0x81f1f98) at worker.c:632
#12 0x080831f6 in worker_thread (thd=0x8116d48, dummy=0x81beb78) at 
#13 0x4010e090 in dummy_worker (opaque=0x8116d48) at thread.c:127
#14 0x4011dfef in pthread_start_thread () from /lib/i686/libpthread.so.0
#15 0x4011e0df in pthread_start_thread_event () from /lib/i686/libpthread.so.0

More information about the Mod_python mailing list