[snake-farm] Re: [Python-Dev] Snake farm

Marc Recht marc@informatik.uni-bremen.de
11 Nov 2002 11:00:33 +0100

Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

> Marc, pymalloc is supposed to be bulletproof.  If there's a segfault
> that can be avoided by disabling pymalloc, that's a bug in pymalloc.
> Would you mind helping us find this bug?
No problem. Environment: FreeBSD-current (Nov. 8th), Python CVS Sources
Nov. 11th (~ 10:00 CEST).
cputime         unlimited
filesize        unlimited
datasize        512MB
stacksize       64MB
coredumpsize    unlimited
memoryuse       unlimited
memorylocked    unlimited
maxproc         7390
descriptors     32768
sockbufsize     unlimited
vmemorysize     unlimited

I compiled Python with no optimization flags set and my changes to
pyconfig.h.in/configure.in (removes XOPEN_*,POSIX_* in the FreeBSD case
to get it compiled). The only configure argument was prefix.

/usr/bin/install -c ./install-sh
./python -E ./setup.py install \
   	--prefix=3D/opt/local/python \
	--install-scripts=3D/opt/local/python/bin \
running install
running build
running build_ext
gmake: *** [sharedinstall] Segmentation fault (core dumped)

713		if (ADDRESS_IN_RANGE(p, pool->arenaindex)) {

(gdb) bt
#0  0x080779c0 in PyObject_Free (p=3D0x800) at Objects/obmalloc.c:713
#1  0x080e00a0 in function_call (func=3D0x82641ec, arg=3D0x8258b8c,
kw=3D0x826bbdc) at Objects/funcobject.c:481
#2  0x080599fb in PyObject_Call (func=3D0x82641ec, arg=3D0x8258b8c,
kw=3D0x826bbdc) at Objects/abstract.c:1688
#3  0x080a7950 in ext_do_call (func=3D0x82641ec, pp_stack=3D0xbfbfdfa4,
flags=3D2, na=3D1, nk=3D0) at Python/ceval.c:3453
#4  0x080a4b64 in eval_frame (f=3D0x81d400c) at Python/ceval.c:2043
#5  0x080a5e1e in PyEval_EvalCodeEx (co=3D0x820e620, globals=3D0x819a57c,
locals=3D0x0, args=3D0x831ad70, argcount=3D1, kws=3D0x831ad74, kwcount=3D0,
defs=3D0x0, defcount=3D0, closure=3D0x0) at Python/ceval.c:2554
#6  0x080a73c3 in fast_function (func=3D0x82378ec, pp_stack=3D0xbfbfe194,
n=3D1, na=3D1, nk=3D0) at Python/ceval.c:3297
#7  0x080a72af in call_function (pp_stack=3D0xbfbfe194, oparg=3D0) at
#8  0x080a4a50 in eval_frame (f=3D0x831ac0c) at Python/ceval.c:2009

(gdb) l
709		if (p =3D=3D NULL)	/* free(NULL) has no effect */
710			return;
712		pool =3D POOL_ADDR(p);
713		if (ADDRESS_IN_RANGE(p, pool->arenaindex)) {
714			/* We allocated this address. */
715			LOCK();
716			/*
717			 * Link p to the start of the pool's freeblock list.  Since

Here ?

(gdb) p pool
$1 =3D (struct pool_header *) 0x0

(gdb) p p
$2 =3D (void *) 0x800

(gdb) x 0x800
0x800:	Cannot access memory at address 0x800

This doesn't happen if either --without-pymalloc or --with-pydebug is

"Premature optimization is the root of all evil." -- Donald E. Knuth

Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

Version: GnuPG v1.2.1 (FreeBSD)