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.

Author PythonInTheGrass
Recipients PythonInTheGrass
Date 2011-01-14.17:37:24
SpamBayes Score 5.6232796e-14
Marked as misclassified No
Message-id <1295026647.31.0.671636636712.issue10909@psf.upfronthosting.co.za>
In-reply-to
Content
New to Python; be gentle if I've simply missed something. i'M running on Windows XP, using a recently downloaded 2.7.1. I'm running by hitting F5 in IDLE.

The attached .py creates 2 threads, one which updates a Tkinter label 10 times a second forever, and one which sleeps for a second and then thrashes the CPU for ~4 seconds, forever. I wrote this to see how Python dealt with CPU-pig threads, and was pleased to see both threads got to run in a decently interleaved way, even in the face of a tight loop.

But at a random point, one of the threads (which one varies) stops running. The other continues fine. The problem manifests in less then 5 minutes (often less than 1).

At least once, but not ever time, the thread that stopped gave a traceback:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "D:\Python27\lib\threading.py", line 530, in __bootstrap_inner
    self.run()
  File "F:\Python27\MyProjects\e.py", line 24, in run
    print "evil!"              #<--- point 1
  File "D:\Python27\lib\idlelib\rpc.py", line 595, in __call__
    value = self.sockio.remotecall(self.oid, self.name, args, kwargs)
  File "D:\Python27\lib\idlelib\rpc.py", line 211, in remotecall
    return self.asyncreturn(seq)
  File "D:\Python27\lib\idlelib\rpc.py", line 240, in asyncreturn
    response = self.getresponse(seq, wait=0.05)
  File "D:\Python27\lib\idlelib\rpc.py", line 280, in getresponse
    response = self._getresponse(myseq, wait)
  File "D:\Python27\lib\idlelib\rpc.py", line 305, in _getresponse
    cvar = self.cvars[myseq]
KeyError: 8680

BUT in some cases there wasn't a traceback (the last time there wasn't, it was BThread that had stopped running; the label was no longer updating.)

If you comment out the print at point 2, or point 1, it seems to work fine, at least for as long as I cared to watch it.

Also, I've noticed that if I close the app's window, that at least one thread keeps running and writing to the Python shell console. (One generally dies because the Tkinter label has gone away). They are both marked as daemonic; shouldn't they stop more or less instantly?
History
Date User Action Args
2011-01-14 17:37:27PythonInTheGrasssetrecipients: + PythonInTheGrass
2011-01-14 17:37:27PythonInTheGrasssetmessageid: <1295026647.31.0.671636636712.issue10909@psf.upfronthosting.co.za>
2011-01-14 17:37:25PythonInTheGrasslinkissue10909 messages
2011-01-14 17:37:24PythonInTheGrasscreate