Bugs item #1758146, was opened at 2007-07-21 18:12
Message generated for change (Comment added) made by timbishop
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1758146&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tim Bishop (timbishop)
Assigned to: Nobody/Anonymous (nobody)
Summary: Crash in PyObject_Malloc
Initial Comment:
I'm running the following on Solaris 9 SPARC:
python 2.5
apache 2.2
mod_python 3.3.1
subversion 1.4.4
trac 0.11dev
Trac is a web application that's written in python and is running through
apache using mod_python. It also uses the subversion python libraries.
After an undetermined amount of clicks (usually in the order of a minute or two
of randomly clicking around) the apache child process dies:
[Sat Jul 21 17:47:27 2007] [error] [client myip] mod_python (pid=15138,
interpreter='my.site.com', phase='PythonHandler',
handler='trac.web.modpython_frontend'): Application error, referer:
http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] ServerName: 'my.site.com',
referer: http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] DocumentRoot:
'/path/to/docroot', referer: http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] URI: '/trac/', referer:
http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] Location: '/trac', referer:
http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] Directory: None, referer:
http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] Filename: '/path/to/docroot',
referer: http://my.site.com/
[Sat Jul 21 17:47:27 2007] [error] [client myip] PathInfo: '/trac/', referer:
http://my.site.com/
It's dumped a core file. Examining that with gdb shows a Bus error here:
Core was generated by `/usr/local/sbin/httpd -DLocalConfig -k start'.
Program terminated with signal 10, Bus error.
#0 PyObject_Malloc (nbytes=16) at Objects/obmalloc.c:747
747 if ((pool->freeblock = *(block **)bp) != NULL) {
(gdb) l
742 * Pick up the head block of its free list.
743 */
744 ++pool->ref.count;
745 bp = pool->freeblock;
746 assert(bp != NULL);
747 if ((pool->freeblock = *(block **)bp) != NULL) {
748 UNLOCK();
749 return (void *)bp;
750 }
751 /*
(gdb)
Full gdb output is attached.
I've tried disabling pymalloc when building python, but the problem just moves
elsewhere. However, with pymalloc enabled it's consistently on this line.
Do you have advice on how to debug this further?
--
>Comment By: Tim Bishop (timbishop)
Date: 2007-07-25 11:25
Message:
Logged In: YES
user_id=25567
Originator: YES
I'm wondering if this Abort is a red herring. It's caused by the following
section in PyThreadState_Swap in Python/pystate.c:
#if defined(Py_DEBUG) && defined(WITH_THREAD)
if (newts) {
/* This can be called from PyEval_RestoreThread().
Similar
to it, we need to ensure errno doesn't change.
*/
int err = errno;
PyThreadState *check = PyGILState_GetThisThreadState();
if (check && check->interp == newts->interp && check !=
newts)
Py_FatalError("Invalid thread state for this
thread");
errno = err;
}
#endif
Specifically this test is true:
check->interp == newts->interp
I'm not convinced if this is right, and a friend who's a bit more clued up
than me isn't sure either.
Could someone look at it to check?
--
Comment By: Tim Bishop (timbishop)
Date: 2007-07-24 14:01
Message:
Logged In: YES
user_id=25567
Originator: YES
Hi,
That patch is included in 2.5.1, so I don't think it's that causing the
problem.
Tim.
--
Comment By: Neal Norwitz (nnorwitz)
Date: 2007-07-24 06:29
Message:
Logged In: YES
user_id=33168
Originator: NO
This gives me an idea. Are you using threads and generators, perhaps?
Could this be related to Bug #1579370? http://python.org/sf/1579370 You
can find a short discussion on it from python-dev around Jan 22-23. Martin
checked in rev 53531 on trunk. This change might be in 2.5.1, I don't
remember when it came out. Try rebuilding Python with this patch installed
and see if it fixes your problem.