473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

python 2.3.2 hangs when returning an int

Any advice on the following would be much appreciated. I have thrown
everything I have at it and am completely stumped. I apologize for the
length, I have tried to be as succint as possible.

I have a pythoncard/wxPython application. The application works well
except that users were reporting occasional crashes. The application
would simply stop and just hang. I was able to reproduce the bug
faithfully and ran the application in the python debugger pdb.py.
The trace is below and I simply cannot understand why it is hanging
where it is. The application gets stuck executing

return len(self.data[0])

which is in this function

def GetNumberCols(self):
if len(self.data) <= 0:
return 0
else:
return len(self.data[0])

This works many many times during the applications execution, indeed
several successful runs of this line are visible immediatley above the
hang. I have also printed out the value of self.data. This is a list
containing 12 inner lists each of length 3 at the point of the hang and
is never larger than that.
What on earth could cause this to stop the interpreter cold in its
tracks without an exception being thrown? CPU usage on the machine is
high throughout the application's execution and stays as such after the
"hang" begins. I eventually kill the app although I have let it run for
a long time and it never leaves this line.
For what its worth, I am using python 2.3.2 on windows2k.

Anyone have idea what could be happening?

c:\python23\lib\site-packages\wxpython\grid.py(664)_setOORInfo()->None
-> return val
(Pdb) s
--Return--
c:\python23\lib\site-packages\wxpython\grid.py(850)__init__()->None
-> self._setOORInfo(self)
(Pdb) s
c:\cygwin\home\ar881\development\bt_analysis\conso le\ndbbtable.py(17)__init

__()
-> self.data = data
(Pdb) s
c:\cygwin\home\ar881\development\bt_analysis\conso le\ndbbtable.py(18)__init

__()
-> self.colLabels = headings
(Pdb) s
Jul 18 '05 #1
3 1410
I guess it is a thread synchronization progblem
In that case some other thread modifies self.data leaving it empty in the
time between the if statement expression is evalutaed and the time the
return statement is executed.

Can this be the case?

"omission9" <ru******@salemstate.edu> wrote in message
news:de**************************@posting.google.c om...
Any advice on the following would be much appreciated. I have thrown
everything I have at it and am completely stumped. I apologize for the
length, I have tried to be as succint as possible.

I have a pythoncard/wxPython application. The application works well
except that users were reporting occasional crashes. The application
would simply stop and just hang. I was able to reproduce the bug
faithfully and ran the application in the python debugger pdb.py.
The trace is below and I simply cannot understand why it is hanging
where it is. The application gets stuck executing

return len(self.data[0])

which is in this function

def GetNumberCols(self):
if len(self.data) <= 0:
return 0
else:
return len(self.data[0])

This works many many times during the applications execution, indeed
several successful runs of this line are visible immediatley above the
hang. I have also printed out the value of self.data. This is a list
containing 12 inner lists each of length 3 at the point of the hang and
is never larger than that.
What on earth could cause this to stop the interpreter cold in its
tracks without an exception being thrown? CPU usage on the machine is
high throughout the application's execution and stays as such after the
"hang" begins. I eventually kill the app although I have let it run for
a long time and it never leaves this line.
For what its worth, I am using python 2.3.2 on windows2k.

Anyone have idea what could be happening?

c:\python23\lib\site-packages\wxpython\grid.py(664)_setOORInfo()->None
-> return val
(Pdb) s
--Return--
c:\python23\lib\site-packages\wxpython\grid.py(850)__init__()->None
-> self._setOORInfo(self)
(Pdb) s
c:\cygwin\home\ar881\development\bt_analysis\conso le\ndbbtable.py(17)__init
__()
-> self.data = data
(Pdb) s
c:\cygwin\home\ar881\development\bt_analysis\conso le\ndbbtable.py(18)__init
__()
-> self.colLabels = headings
(Pdb) s

Jul 18 '05 #2
ru******@salemstate.edu (omission9) writes:
Any advice on the following would be much appreciated. I have thrown
everything I have at it and am completely stumped. I apologize for the
length, I have tried to be as succint as possible.

I have a pythoncard/wxPython application. The application works well
except that users were reporting occasional crashes. The application
would simply stop and just hang. I was able to reproduce the bug
faithfully and ran the application in the python debugger pdb.py.
The trace is below and I simply cannot understand why it is hanging
where it is. The application gets stuck executing

return len(self.data[0])


Does pythoncard or wxPython (or your program) use weak references?
There have been serious bugs fixed with weakrefs in Python 2.3.3.

Thomas
Jul 18 '05 #3
Thanks to all who responded. This took me forever to replicate and is
not that easy to demonstrate outside of my fairly complex application.
Basically, I feel that this is the fault of the Python garbage
collector. What was happening was that in one function I locally defined
a class which extended wxGrid. In another function, which was called by
the first one mentioned, I instantiated another instance, local to the
function, of that class. It seems that even though the wxGrid class
used in the calling function was only used after the function call
some stray references or something to the other instance were still
drifting around in the interpreter which were causing some bizarro
problems like the one in my original post. By eliminating the instance
in the function that was being called I eliminated the problem.
BIZARRE!! What made this so awful was that it took many many iterations
of these functions to generate the error. I have no idea why it didn't
blow the first, say, hundred times through.
Maybe if I ever get the motivation I'll attach a C debugger to the whole
thing and look deeper into the guts.
omission9 wrote:
Any advice on the following would be much appreciated. I have thrown
everything I have at it and am completely stumped. I apologize for the
length, I have tried to be as succint as possible.

I have a pythoncard/wxPython application. The application works well
except that users were reporting occasional crashes. The application
would simply stop and just hang. I was able to reproduce the bug
faithfully and ran the application in the python debugger pdb.py.
The trace is below and I simply cannot understand why it is hanging
where it is. The application gets stuck executing

return len(self.data[0])

which is in this function

def GetNumberCols(self):
if len(self.data) <= 0:
return 0
else:
return len(self.data[0])

This works many many times during the applications execution, indeed
several successful runs of this line are visible immediatley above the
hang. I have also printed out the value of self.data. This is a list
containing 12 inner lists each of length 3 at the point of the hang and
is never larger than that.
What on earth could cause this to stop the interpreter cold in its
tracks without an exception being thrown? CPU usage on the machine is
high throughout the application's execution and stays as such after the
"hang" begins. I eventually kill the app although I have let it run for
a long time and it never leaves this line.
For what its worth, I am using python 2.3.2 on windows2k.

Anyone have idea what could be happening?

c:\python23\lib\site-packages\wxpython\grid.py(664)_setOORInfo()->None
-> return val
(Pdb) s
--Return--
c:\python23\lib\site-packages\wxpython\grid.py(850)__init__()->None
-> self._setOORInfo(self)
(Pdb) s
c:\cygwin\home\ar881\development\bt_analysis\conso le\ndbbtable.py(17)__init

__()
-> self.data = data
(Pdb) s
c:\cygwin\home\ar881\development\bt_analysis\conso le\ndbbtable.py(18)__init

__()
-> self.colLabels = headings
(Pdb) s


Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: JD | last post by:
This is another Python problem, I think might be unrelated to the earlier bug I found, and eventually figured out how to report it to Sourceforge. This is related to a question I have about...
2
by: Eric Woudenberg | last post by:
I just installed a Python 2.3.4 Windows binary on a friend's WinXP machine (because the latest Cygwin-provided Python 2.3 build leaves out the winsound module for some reason). When I try and...
8
by: mbukhin | last post by:
I'm using the ftp library (layer on top of sockets) to transfer files from a series 60 to an ftp site. everything works fine, the whole file gets uploaded but the command never returns! so i...
0
by: johan2sson | last post by:
I have embedded a python console in a plugin to a Windows application. I do not control the application, but the plugin is mine. Since the application is not thread-safe, I am push()-ing each line...
2
by: Pierre Rouleau | last post by:
Hi all, I have a consistent test case where os.popen3() hangs in Windows. The system hangs when retrieving the lines from the child process stdout. I know there were several reports related to...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 421 open ( +3) / 3530 closed ( +8) / 3951 total (+11) Bugs : 963 open ( +4) / 6426 closed (+21) / 7389 total (+25) RFE : 255 open...
2
by: Patrick Finnegan | last post by:
Running db2 8.2 ON aIX 5.3. We have a third party USEREXIT program that periodically hangs for some unknown reason. Db2 generates error message to the diag log. MESSAGE : Successfully...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.