[Python-bugs-list] [Bug #128302] Repeatedly initializing the interpreter dumps core

noreply@sourceforge.net noreply@sourceforge.net
Sat, 13 Jan 2001 14:07:21 -0800


Bug #128302, was updated on 2001-Jan-10 09:15
Here is a current snapshot of the bug.

Project: Python
Category: Python Interpreter Core
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 4
Submitted by: gvanrossum
Assigned to : gvanrossum
Summary: Repeatedly initializing the interpreter dumps core

Details: I've checked in a simple test program: Demo/embed/loop.c.  If you
run "make looptest" in this directory, you should get a few lines of 'hello
world' followed by a core dump.


Follow-Ups:

Date: 2001-Jan-13 14:07
By: gvanrossum

Comment:
Thanks, Neil!

I clearly need to learn about efence myself. :-)

The loop program now leaks memory, slowly; I'll ask Barry to look at that.
-------------------------------------------------------

Date: 2001-Jan-13 11:40
By: nascheme

Comment:
The GC always gets the blame, doesn't it?  ;-)

I get setfaults all over the place.  Linking with efence
gives this segfault:

(gdb) run "print 1"
Starting program: /home/nas/Python/py/Demo/embed/loop "print 1"

  Electric Fence 2.0.5 Copyright (C) 1987-1998 Bruce Perens.
1

Program received signal SIGSEGV, Segmentation fault.
0x8055ff9 in _PySys_Init () at sysmodule.c:634
634                     Py_INCREF(warnoptions);
(gdb) p *warnoptions
$1 = {ob_refcnt = 0, ob_type = 0x818b820}
(gdb) bt
#0  0x8055ff9 in _PySys_Init () at sysmodule.c:634
#1  0x8052fd7 in Py_Initialize () at pythonrun.c:135
#2  0x8052de9 in main (argc=2, argv=0xbffffaac) at loop.c:21

This code looks a bit suspect to me:

	if (warnoptions != NULL) {
		PyDict_SetItemString(sysdict, "warnoptions", v = warnoptions);
		Py_DECREF(v);
	}

Removing the decref seems to solve the problem.  Back to
you Guido.

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

Date: 2001-Jan-13 09:27
By: gvanrossum

Comment:
Neil, do you mind if I assign this to you?  When I look at this in gdb, it
usually seems to have crashed somewhere in the GC code.

Could you give it a quick look over?  Is it possible that the GC code
doesn't do the right thing when Py_Finalize() and Py_Initialize() are
called more than once?

If you don't have time or don't think it's GC's fault, please give it back
to me or to None.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=128302&group_id=5470