Bug 640432 - crash in mod_python when accessing a koji server
Summary: crash in mod_python when accessing a koji server
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mod_python
Version: 14
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Joe Orton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 647457 (view as bug list)
Depends On:
Blocks: PyCObject
TreeView+ depends on / blocked
 
Reported: 2010-10-05 19:34 UTC by Fabrice Bellet
Modified: 2010-11-18 09:52 UTC (History)
13 users (show)

Fixed In Version: mod_python-3.3.1-14.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-17 23:21:28 UTC
Type: ---


Attachments (Terms of Use)
Fix crash by removing use of deprecated functions (2.48 KB, patch)
2010-10-20 08:47 UTC, Jonathan Liu
no flags Details | Diff

Description Fabrice Bellet 2010-10-05 19:34:10 UTC
I have a koji server running on a box, that I updated to Fedora 14. Accessing the koji homepage now causes a crash in httpd. Here is the backtrace :

(gdb) r -DFOREGROUND -DNO_DETACH -X
Starting program: /usr/sbin/httpd -DFOREGROUND -DNO_DETACH -X
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeb6ad9f5 in setup_context (message=
    'The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.', category=<type at remote 0x7fffeb97a140>, 
    stack_level=<value optimized out>)
    at /usr/src/debug/Python-2.7/Python/_warnings.c:449
449	    PyFrameObject *f = PyThreadState_GET()->frame;
(gdb) bt
#0  0x00007fffeb6ad9f5 in setup_context (message=
    'The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.', category=<type at remote 0x7fffeb97a140>, 
    stack_level=<value optimized out>)
    at /usr/src/debug/Python-2.7/Python/_warnings.c:449
#1  do_warn (message=
    'The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.', category=<type at remote 0x7fffeb97a140>, 
    stack_level=<value optimized out>)
    at /usr/src/debug/Python-2.7/Python/_warnings.c:593
#2  0x00007fffeb6adf5b in PyErr_WarnEx (category=
    <type at remote 0x7fffeb97a140>, text=<value optimized out>, stack_level=1)
    at /usr/src/debug/Python-2.7/Python/_warnings.c:719
#3  0x00007fffeb64291e in PyCObject_FromVoidPtr (cobj=0x7ffff881e720, destr=0)
    at /usr/src/debug/Python-2.7/Objects/cobject.c:25
#4  0x00007fffeb9cd52b in save_interpreter (name=0x7ffff83348f8 "bellet.info", 
    istate=0x7ffff879bf80) at mod_python.c:185
#5  0x00007fffeb9cd6cd in get_interpreter (name=0x7ffff83348f8 "bellet.info")
    at mod_python.c:261
#6  0x00007fffeb9d1303 in python_handler (req=0x7ffff8795ff8, phase=
    0x7fffeb9d24bf "PythonHandler") at mod_python.c:1628
#7  0x00007ffff7fd8788 in ap_run_handler (r=0x7ffff8795ff8)
    at /usr/src/debug/httpd-2.2.16/server/config.c:158
---Type <return> to continue, or q <return> to quit--- 
#8  0x00007ffff7fd8bec in ap_invoke_handler (r=0x7ffff8795ff8)
    at /usr/src/debug/httpd-2.2.16/server/config.c:376
#9  0x00007ffff7fe6390 in ap_process_request (r=0x7ffff8795ff8)
    at /usr/src/debug/httpd-2.2.16/modules/http/http_request.c:282
#10 0x00007ffff7fe3458 in ap_process_http_connection (c=0x7ffff8789fd8)
    at /usr/src/debug/httpd-2.2.16/modules/http/http_core.c:190
#11 0x00007ffff7fdf3d8 in ap_run_process_connection (c=0x7ffff8789fd8)
    at /usr/src/debug/httpd-2.2.16/server/connection.c:43
#12 0x00007ffff7feadca in child_main (child_num_arg=<value optimized out>)
    at /usr/src/debug/httpd-2.2.16/server/mpm/prefork/prefork.c:662
#13 0x00007ffff7feb096 in make_child (s=0x7ffff8212860, slot=0)
    at /usr/src/debug/httpd-2.2.16/server/mpm/prefork/prefork.c:702
#14 0x00007ffff7feb873 in ap_mpm_run (_pconf=<value optimized out>, 
    plog=<value optimized out>, s=<value optimized out>)
    at /usr/src/debug/httpd-2.2.16/server/mpm/prefork/prefork.c:978
#15 0x00007ffff7fc375e in main (argc=4, argv=0x7fffffffe628)
    at /usr/src/debug/httpd-2.2.16/server/main.c:740

Comment 1 Dave Malcolm 2010-10-18 16:24:43 UTC
mod_python uses the PyCObject API, but this was deprecated in 2.7 (and, in fact will be removed in 3.2, though AIUI, mod_python won't be ported to python 3)

From a prepped source tree of mod_python-3.3.1-13:
find -exec grep -nH -e "PyCObject" "{}" \;
./src/serverobject.c:228:        return PyCObject_FromVoidPtr(self->server, 0);
./src/requestobject.c:1614:        return PyCObject_FromVoidPtr(self->request_rec, 0);
./src/connobject.c.buckets:429:        return PyCObject_FromVoidPtr(self->conn, 0);
./src/connobject.c:429:        return PyCObject_FromVoidPtr(self->conn, 0);
./src/mod_python.c:185:    p = PyCObject_FromVoidPtr((void *) idata, NULL);
./src/mod_python.c:264:        idata = (interpreterdata *)PyCObject_AsVoidPtr(p);

In particular, the final two "grep" hits are in "save_interpreter", and "get_interpreter"; they appear to assume that the call into PyCObject will succeed.  If warnings-as-errors is enabled, this will lead to a crash inside Python, perhaps the one seen above.

Comment 2 Dave Malcolm 2010-10-18 16:25:55 UTC
Upstream notes: http://docs.python.org/dev/whatsnew/2.7.html#capsules

Comment 3 Jonathan Liu 2010-10-20 08:47:51 UTC
Created attachment 454534 [details]
Fix crash by removing use of deprecated functions

This patch replaces use of the PyCObject API with PyCapsule API so that it longer uses deprecated functions or crashes.

Comment 4 Fabrice Bellet 2010-10-21 12:42:38 UTC
The patch works for me. Thanks!

Comment 5 Sean Reifschneider 2010-10-28 01:55:04 UTC
This patch also works for me.  In my case I had done a fresh beta install, a yum update, and then installed Cobbler.  The web interface was causing Seg faults in the Apache error_log.  Applying this patch to mod_python and rebuilding allows me to access the site.

Previously when I had this problem (a few weeks ago, also on the F14 beta), I had definitely tracked it down to mod_python, but didn't have time to track it further than that.

Comment 6 Dave Malcolm 2010-10-28 16:55:20 UTC
*** Bug 647457 has been marked as a duplicate of this bug. ***

Comment 7 Bojan Smojver 2010-10-31 05:16:25 UTC
I think I'm seeing the same with viewvc on F-14.

Comment 8 Bojan Smojver 2010-10-31 13:34:55 UTC
Anyone has a koji URL to a build where this was fixed?

Comment 9 Toshio Ernie Kuratomi 2010-10-31 16:01:24 UTC
ping -- does this need to be reassigned to mod_python and the patch applied there?

Comment 10 Bojan Smojver 2010-10-31 22:20:04 UTC
Reassigning to mod_python. Please apply the patch and rebuild.

Comment 11 Bojan Smojver 2010-10-31 22:35:53 UTC
Changing priority and severity, because other software is affected by this failure.

Comment 12 Bojan Smojver 2010-11-01 07:01:58 UTC
Any chance we get %{?dist} added to release at the same time, so that it's easier to tell what the package is for?

Comment 13 Toshio Ernie Kuratomi 2010-11-02 20:16:59 UTC
jorton: I'll go ahead and push an update to F14 for with the attached patch.  I'll leave it in the testing repository for the full two weeks so holler if you think this is the wrong thing to do and I won't push it to stable.

Comment 14 Fedora Update System 2010-11-02 21:53:31 UTC
mod_python-3.3.1-14.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mod_python-3.3.1-14.fc14

Comment 15 Fedora Update System 2010-11-03 21:10:45 UTC
mod_python-3.3.1-14.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mod_python'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/mod_python-3.3.1-14.fc14

Comment 16 Fedora Update System 2010-11-17 23:21:22 UTC
mod_python-3.3.1-14.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Bas Mevissen 2010-11-18 09:52:59 UTC
With mod_python-3.3.1-12.fc14, trac also segfaulted on Fedora 14. The update mod_python-3.3.1-14.fc14 solved the issue. Thanks!


Note You need to log in before you can comment on or make changes to this bug.