This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Core Dumps : Python2.2.2
Type: Stage:
Components: None Versions: Python 2.2
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: elirosenberg, facundobatista, loewis, mwh, nnorwitz
Priority: normal Keywords:

Created on 2003-04-24 22:16 by elirosenberg, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (9)
msg15599 - (view) Author: Eli Rosenberg (elirosenberg) Date: 2003-04-24 22:16
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.Modules/gcmodule.c":868,
0x10092244]
   5 _PyObject_GC_New(tp = 0x1013fbe0)
["/usr/people/eli/Python-2.Modules/gcmodule.c":895,
0x10092368]
   6 newtracebackobject(next = (nil), frame =
0x1016b670, lasti = 21, lineno = 1)
["/usr/people/eli/Python-2.Python/traceback.c":115,
0x100c6684]
   7 PyTraceBack_Here(frame = 0x1016b670)
["/usr/people/eli/Python-2.Python/traceback.c":133,
0x100c67f4]
   8 eval_frame(f = 0x1016b670)
["/usr/people/eli/Python-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.Python/ceval.c":2595,
0x1004ffe0
   10 PyEval_EvalCode(co = 0x1016e990, globals =
0x1016a5d0, locals = 0x1016a5d0)
["/usr/people/eli/Python-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.Python/pythonrun.c":1079,
0x1006f380]
   12 PyRun_InteractiveOneFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.Python/pythonrun.c":590,
0x1006d57c]
   13 PyRun_InteractiveLoopFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.Python/pythonrun.c":526,
0x1006d198]
   14 PyRun_AnyFileExFlags(fp = 0xfb53680, filename =
0x1014e978 = "<stdin>", closeit = 0, flags =
0x7fff2e2c)
["/usr/people/eli/Python-2.Python/pythonrun.c":489,
0x1006cf48]
   15 Py_Main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-2.Modules/main.c":364,
0x1000fa44]
   16 main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-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.Modules/gcmodule.c":868,
0x10092244]
   5 _PyObject_GC_New(tp = 0x1013fbe0)
["/usr/people/eli/Python-2.Modules/gcmodule.c":895,
0x10092368]
   6 newtracebackobject(next = (nil), frame =
0x1016b670, lasti = 21, lineno = 1)
["/usr/people/eli/Python-2.Python/traceback.c":115,
0x100c6684]
   7 PyTraceBack_Here(frame = 0x1016b670)
["/usr/people/eli/Python-2.Python/traceback.c":133,
0x100c67f4]
   8 eval_frame(f = 0x1016b670)
["/usr/people/eli/Python-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.Python/ceval.c":2595,
0x1004ffe0
   10 PyEval_EvalCode(co = 0x1016e990, globals =
0x1016a5d0, locals = 0x1016a5d0)
["/usr/people/eli/Python-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.Python/pythonrun.c":1079,
0x1006f380]
   12 PyRun_InteractiveOneFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.Python/pythonrun.c":590,
0x1006d57c]
   13 PyRun_InteractiveLoopFlags(fp = 0xfb53680,
filename = 0x1014e978 = "<stdin>", flags = 0x7fff2e2c)
["/usr/people/eli/Python-2.Python/pythonrun.c":526,
0x1006d198]
   14 PyRun_AnyFileExFlags(fp = 0xfb53680, filename =
0x1014e978 = "<stdin>", closeit = 0, flags =
0x7fff2e2c)
["/usr/people/eli/Python-2.Python/pythonrun.c":489,
0x1006cf48]
   15 Py_Main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-2.Modules/main.c":364,
0x1000fa44]
   16 main(argc = 1, argv = 0x7fff2f24)
["/usr/people/eli/Python-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
msg15600 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-04-25 10:53
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?
msg15601 - (view) Author: Eli Rosenberg (elirosenberg) Date: 2003-04-25 17:41
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
msg15602 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-04-25 18:06
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...
msg15603 - (view) Author: Eli Rosenberg (elirosenberg) Date: 2003-04-25 18:28
Logged In: YES 
user_id=764663

Hmm, I don't know for sure, but closing might not be
the best idea because anyone else building on a 
really recent IRIX will have problems with socketmodule.
Is there an IRIX maintainer or somebody like that?

msg15604 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-04-25 19:03
Logged In: YES 
user_id=21627

No. Except for MacOS, there is are no port maintainers. 
There are experts for some of the Unices, but only for Linux 
and Solaris. For things as strange as Irix, we have to have 
actual users of the systems to fully understand the problem 
and provide patches.

In general, we accept work-arounds only if it can be shown 
that a work-around is necessary around a true platform bug 
(see how the getaddrinfo emulation is used on OSX, even 
though the platform provides a native implementation).

I'm pretty certain that Python's usage of the getaddrinfo API 
is correct. If this is still causing crashes, it may be that the 
implementation in the Irix library is buggy. Have you applied 
all vendor patches?
msg15605 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-05-25 01:56
Logged In: YES 
user_id=33168

I can't reproduce this problem with 2.2.3 on Irix 6.5:

% uname -a
IRIX rattler 6.5 10120734 IP32
msg15606 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-01-15 17:54
Logged In: YES 
user_id=752496

Please, could you verify if this problem persists in Python 2.3.4
or 2.4?

If yes, in which version? Can you provide a test case?

If the problem is solved, from which version?

Note that if you fail to answer in one month, I'll close this bug
as "Won't fix".

Thank you! 

.    Facundo
msg15607 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-05-30 19:02
Logged In: YES 
user_id=752496

Deprecated. Reopen only if still happens in 2.3 or newer. 

.    Facundo
History
Date User Action Args
2022-04-10 16:08:19adminsetgithub: 38363
2003-04-24 22:16:20elirosenbergcreate