[Python-bugs-list] [ python-Bugs-727241 ] Core Dumps : Python2.2.2

SourceForge.net noreply@sourceforge.net
Fri, 25 Apr 2003 11:06:46 -0700


Bugs item #727241, was opened at 2003-04-24 23:16
Message generated for change (Comment added) made by mwh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=727241&group_id=5470

Category: None
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Eli Rosenberg (elirosenberg)
Assigned to: Nobody/Anonymous (nobody)
Summary: Core Dumps : Python2.2.2 

Initial Comment:

Hello,
I am able to cause python to core dump on IRIX
6.5.18 and above with the code listed below.  I have
compiled with 3 versions of gcc as well as MIPSpro.

Running this code with a valid host and a port
that will cause a connection refused socket error
produces a core dump with the the stack trace below.

>>> import socket
>>> x=socket.socket()
>>> x.connect(('www.google.com', 1234))


>  0 realfree(0x10162e98, 0x0, 0x200000, 0x65637469,
0x17dd4, 0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":527,
0xfb245fc]
   1 cleanfree(0x0, 0x0, 0x200000, 0x65637469, 0x17dd4,
0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":945,
0xfb24e44]
   2 __malloc(0x28, 0x0, 0x200000, 0x65637469, 0x17dd4,
0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":230,
0xfb24078]
   3 _malloc(0x28, 0x0, 0x200000, 0x65637469, 0x17dd4,
0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":186,
0xfb23ee4]
   4 _PyObject_GC_Malloc(tp = 0x1013fbe0, nitems = 0)
["/usr/people/eli/Python-2.2.2/Modules/gcmodule.c":868,
0x10092244]
   5 _PyObject_GC_New(tp = 0x1013fbe0)
["/usr/people/eli/Python-2.2.2/Modules/gcmodule.c":895,
0x10092368]
   6 newtracebackobject(next = (nil), frame =
0x1016b670, lasti = 21, lineno = 1)
["/usr/people/eli/Python-2.2.2/Python/traceback.c":115,
0x100c6684]
   7 PyTraceBack_Here(frame = 0x1016b670)
["/usr/people/eli/Python-2.2.2/Python/traceback.c":133,
0x100c67f4]
   8 eval_frame(f = 0x1016b670)
["/usr/people/eli/Python-2.2.2/Python/ceval.c":2238,
0x1004e894]
   9 PyEval_EvalCodeEx(co = 0x1016e990, globals =
0x1016a5d0, locals = 0x1016a5d0, args = (nil), argcount
= 0, kws = (nil), kwcount = 0, defs = (nil), defcount =
0, closure = (nil))
["/usr/people/eli/Python-2.2.2/Python/ceval.c":2595,
0x1004ffe0
   10 PyEval_EvalCode(co = 0x1016e990, globals =
0x1016a5d0, locals = 0x1016a5d0)
["/usr/people/eli/Python-2.2.2/Python/ceval.c":481,
0x10047ea0]
   11 run_node(n = 0x101a5b28, filename = 0x1014e978 =
"<stdin>", globals = 0x1016a5d0, locals = 0x1016a5d0,
flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":1079,
0x1006f380]
   12 PyRun_InteractiveOneFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":590,
0x1006d57c]
   13 PyRun_InteractiveLoopFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":526,
0x1006d198]
   14 PyRun_AnyFileExFlags(fp = 0xfb53680, filename =
0x1014e978 = "<stdin>", closeit = 0, flags =
0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":489,
0x1006cf48]
   15 Py_Main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-2.2.2/Modules/main.c":364,
0x1000fa44]
   16 main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-2.2.2/Modules/python.c":10,
0x1000ecdc]
   17 __start()
["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_n32_M4/csu/crt1text.s":177,
0x1000ec78]

I compiled Python 64-bit and the code above appears
not to cause a segfault but the code below will
bus error after a few iterations.

import socket
import time

def doit():
          s = socket.socket()
          start = time.time()
          
          try:
               s.connect(('www.cnn.com', 80))
          except socket.error,e:
               print repr(e),str(e)
          finish = time.time()
          time.sleep(.5)
          print str(finish-start),"\n"
          s.close()

for x in xrange(10):
     doit()

Here is the stack trace:

>  0 realfree(0x10162e98, 0x0, 0x200000, 0x65637469,
0x17dd4, 0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":527,
0xfb245fc]
   1 cleanfree(0x0, 0x0, 0x200000, 0x65637469, 0x17dd4,
0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":945,
0xfb24e44]
   2 __malloc(0x28, 0x0, 0x200000, 0x65637469, 0x17dd4,
0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":230,
0xfb24078]
   3 _malloc(0x28, 0x0, 0x200000, 0x65637469, 0x17dd4,
0x1, 0x1, 0x8)
["/xlv47/6.5.18f/work/irix/lib/libc/libc_n32_M4/gen/malloc.c":186,
0xfb23ee4]
   4 _PyObject_GC_Malloc(tp = 0x1013fbe0, nitems = 0)
["/usr/people/eli/Python-2.2.2/Modules/gcmodule.c":868,
0x10092244]
   5 _PyObject_GC_New(tp = 0x1013fbe0)
["/usr/people/eli/Python-2.2.2/Modules/gcmodule.c":895,
0x10092368]
   6 newtracebackobject(next = (nil), frame =
0x1016b670, lasti = 21, lineno = 1)
["/usr/people/eli/Python-2.2.2/Python/traceback.c":115,
0x100c6684]
   7 PyTraceBack_Here(frame = 0x1016b670)
["/usr/people/eli/Python-2.2.2/Python/traceback.c":133,
0x100c67f4]
   8 eval_frame(f = 0x1016b670)
["/usr/people/eli/Python-2.2.2/Python/ceval.c":2238,
0x1004e894]
   9 PyEval_EvalCodeEx(co = 0x1016e990, globals =
0x1016a5d0, locals = 0x1016a5d0, args = (nil), argcount
= 0, kws = (nil), kwcount = 0, defs = (nil), defcount =
0, closure = (nil))
["/usr/people/eli/Python-2.2.2/Python/ceval.c":2595,
0x1004ffe0
   10 PyEval_EvalCode(co = 0x1016e990, globals =
0x1016a5d0, locals = 0x1016a5d0)
["/usr/people/eli/Python-2.2.2/Python/ceval.c":481,
0x10047ea0]
   11 run_node(n = 0x101a5b28, filename = 0x1014e978 =
"<stdin>", globals = 0x1016a5d0, locals = 0x1016a5d0,
flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":1079,
0x1006f380]
   12 PyRun_InteractiveOneFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":590,
0x1006d57c]
   13 PyRun_InteractiveLoopFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":526,
0x1006d198]
   14 PyRun_AnyFileExFlags(fp = 0xfb53680, filename =
0x1014e978 = "<stdin>", closeit = 0, flags =
0x7fff2e2c)
["/usr/people/eli/Python-2.2.2/Python/pythonrun.c":489,
0x1006cf48]
   15 Py_Main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-2.2.2/Modules/main.c":364,
0x1000fa44]
   16 main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-2.2.2/Modules/python.c":10,
0x1000ecdc]
   17 __start()
["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_n32_M4/csu/crt1text.s":177,
0x1000ec78]

Any help would be appreciated. thanks.
-Eli

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

>Comment By: Michael Hudson (mwh)
Date: 2003-04-25 19:06

Message:
Logged In: YES 
user_id=6656

so... do you think the fault is with Python or IRIX?

if you're happy enough with the situation as it stands, we may as well close 
this...

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

Comment By: Eli Rosenberg (elirosenberg)
Date: 2003-04-25 18:41

Message:
Logged In: YES 
user_id=764663

Hi, I think I have fixed things...for now. Here is what I see:

IRIX now includes POSIX 1003.1g draft implementations
of getaddrinfo/getnameinfo in accordance with 
http://www.ietf.org/proceedings/01mar/I-D/ipngwg-rfc2553bis-03.txt

Previously, netdb.h on IRIX did not have these definitions and
Python compiled in its own implementations and things seemed
to work.  

I changed pyconfig.h to have socketmodule use its own
implementations, but I did have to make a few changes
because the IRIX prototypes for these functions are
for the 2001 version of the standards, whereas socketmodule
seemed to have 1999 versions from RFC2553.

Not knowing much about the Python C API, I did not 
look closely enough to see why socketmodule
seems to cause memory faults when compiled with 
the IRIX libc versions of these functions.   

Hopefully this is the source of the problem.
-eli


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

Comment By: Michael Hudson (mwh)
Date: 2003-04-25 11:53

Message:
Logged In: YES 
user_id=6656

This looks nasty...

Could you try making a debug build of Python (pass
--with-pydebug to ./configure) and/or try with current CVS?

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=727241&group_id=5470