Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seg fault in gcmodule.c #37790

Closed
greg7mdp mannequin opened this issue Jan 17, 2003 · 8 comments
Closed

Seg fault in gcmodule.c #37790

greg7mdp mannequin opened this issue Jan 17, 2003 · 8 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@greg7mdp
Copy link
Mannequin

greg7mdp mannequin commented Jan 17, 2003

BPO 669838
Nosy @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2003-07-12.02:06:22.000>
created_at = <Date 2003-01-17.17:03:14.000>
labels = ['interpreter-core']
title = 'Seg fault in gcmodule.c'
updated_at = <Date 2003-07-12.02:06:22.000>
user = 'https://bugs.python.org/greg7mdp'

bugs.python.org fields:

activity = <Date 2003-07-12.02:06:22.000>
actor = 'greg7mdp'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Interpreter Core']
creation = <Date 2003-01-17.17:03:14.000>
creator = 'greg7mdp'
dependencies = []
files = []
hgrepos = []
issue_num = 669838
keywords = []
message_count = 8.0
messages = ['14109', '14110', '14111', '14112', '14113', '14114', '14115', '14116']
nosy_count = 3.0
nosy_names = ['nnorwitz', 'rhettinger', 'greg7mdp']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue669838'
versions = ['Python 2.2']

@greg7mdp
Copy link
Mannequin Author

greg7mdp mannequin commented Jan 17, 2003

Using Python 2.2.2 on Linux Redhat 7.2:

Python 2.2.2 (#1, Oct 21 2002, 22:19:12)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2

I have a crash which happens somewhat randomly (for
example it goes away if I add a print statement
somewhere). Here is some gdb info.

lnx:0:usr/greg/ib> gdb python2.2
GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run rules.py > xx
Starting program: /usr/local/bin/python2.2 rules.py > xx
[New Thread 1024 (LWP 30182)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 30182)]
0x080996f8 in visit_decref (op=0x1000000, data=0x0) at
Modules/gcmodule.c:185
185 if (op && PyObject_IS_GC(op)) {
(gdb) print op
$1 = (PyObject *) 0x1000000
(gdb) print data
$2 = (void *) 0x0
(gdb) where 20
#0 0x080996f8 in visit_decref (op=0x1000000, data=0x0)
at Modules/gcmodule.c:185
#1 0x080c9abb in dict_traverse (op=0x827bc34,
visit=0x80996ec <visit_decref>, arg=0x0)
at Objects/dictobject.c:1589
#2 0x0809897e in collect (young=0x80ee5a0,
old=0x80ee5ac) at Modules/gcmodule.c:201
#3 0x08099062 in collect_generations () at
Modules/gcmodule.c:518
#4 0x08099576 in _PyObject_GC_New (tp=0x80f8ae0) at
Modules/gcmodule.c:879
#5 0x080c7b75 in PyDict_New () at
Objects/dictobject.c:161
#6 0x080869d5 in symtable_init () at
Python/compile.c:4671
#7 0x08086910 in symtable_build (c=0xbfffea90,
n=0x8240e68) at Python/compile.c:4261
#8 0x08084109 in jcompile (n=0x8240e68,
filename=0x81f83ec "<string>", base=0x0,
flags=0xbfffebe4)
at Python/compile.c:4111
#9 0x0808665e in PyNode_CompileFlags (n=0x8240e68,
filename=0x81f83ec "<string>", flags=0xbfffebe4)
at Python/compile.c:4042
#10 0x080945c7 in Py_CompileStringFlags (
str=0x811f8bc "agrepy(\"epreuve photographique\", 22, t,
len(t), 0, re[0]) and re[1].search(t)",
filename=0x81f83ec "<string>", start=258,
flags=0xbfffebe4) at Python/pythonrun.c:1133
#11 0x080cc4cc in builtin_compile (self=0x0,
args=0x8241a04) at Python/bltinmodule.c:398
#12 0x080ca7cc in PyCFunction_Call (func=0x8105fb0,
arg=0x8241a04, kw=0x0) at Objects/methodobject.c:100
#13 0x08077918 in eval_frame (f=0x81a6fbc) at
Python/ceval.c:2014
#14 0x0807892b in PyEval_EvalCodeEx (co=0x81f8750,
globals=0x8111ecc, locals=0x0, args=0x82ffe14,
argcount=2, kws=0x82ffe1c, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:2595
#15 0x0807aa43 in fast_function (func=0x815f754,
pp_stack=0xbfffee14, n=2, na=2, nk=0)
at Python/ceval.c:3173
#16 0x080779b5 in eval_frame (f=0x82ffc8c) at
Python/ceval.c:2034
#17 0x0807892b in PyEval_EvalCodeEx (co=0x81f9768,
globals=0x8111ecc, locals=0x0, args=0x81cc34c,
argcount=3, kws=0x81cc358, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:2595
#18 0x0807aa43 in fast_function (func=0x815f78c,
pp_stack=0xbfffef74, n=3, na=3, nk=0)
at Python/ceval.c:3173
#19 0x080779b5 in eval_frame (f=0x81cc1f4) at
Python/ceval.c:2034
(More stack frames follow...)

@greg7mdp greg7mdp mannequin closed this as completed Jan 17, 2003
@greg7mdp greg7mdp mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jan 17, 2003
@greg7mdp
Copy link
Mannequin Author

greg7mdp mannequin commented Jan 17, 2003

Logged In: YES
user_id=222034

I forgot to mention that this program is using the "exec()" builtin
heavily, and I believe that the crash is related to this.

gregory

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Jan 17, 2003

Logged In: YES
user_id=33168

Can you post any code which causes the crash, even if it
only crashes sometimes?
Can you build python with ./configure --with-pydebug and run
your program? This may find the problem closer to the cause.

@greg7mdp
Copy link
Mannequin Author

greg7mdp mannequin commented Jan 24, 2003

Logged In: YES
user_id=222034

It is hard to reproduce... I realized that the bug may be in a
module I use called AGREPY downloadable from
http://www.bio.cam.ac.uk/~mw263/pyagrep.html. I tried to
reproduce my Python 2.2.2 install with "./configure --with-
pydebug" as suggested, but then I get the following error:

/usr/greg/soft/linux/python/Python-2.2.2/python rules.py
Adding parser accelerators ...
Done.
Traceback (most recent call last):
  File "rules.py", line 39, in ?
    import string, os, agrepy
ImportError: /usr/greg/soft/linux/python/Python-
2.2.2/build/lib.linux-i686-2.2/agrepy.so: undefined symbol: 
Py_InitModule4
[6589 refs]

I was mistaken to suspect my use of the "exec" statement,
which I replaced with "eval" and the problem still happened.

It is not easy to come up with a reasonably small piece of code
reproducing the problem!

gregory

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Jan 24, 2003

Logged In: YES
user_id=33168

After running configure, you must remove all the modules and
rebuild them too. This doesn't happen by default. You can
also do rm build//.o build//.so to remove the modules.
make clean should also work.

Have you tried running valgrind, purify, electric fence, or
some other memory checker on the code. Perhaps there is a
memory problem in the pyagrep module?

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented May 22, 2003

Logged In: YES
user_id=33168

Gregory, do you still have this problem? Do you believe
there is a bug or can we close this report?

@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

Greg, can you also try this with Py2.3b2+.
We're about to release it and need to know if your bug is still
present.

@greg7mdp
Copy link
Mannequin Author

greg7mdp mannequin commented Jul 12, 2003

Logged In: YES
user_id=222034

Sorry, I had responded earlier via email but it didn't make it in
sourceforge. I was using the module agrepy and I'm sure that
where the bug is. Since I removed the use of this module from
my code a few month ago the problem has disapeared. So the
python code is fine, there is almost certainly a memory error in
agrepy.
I make a weak attempt at debugging agrepy but didn't have
time to follow through.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

1 participant