[Pythonmac-SIG] Python crash!

Marcus H. Mendenhall marcus.h.mendenhall at vanderbilt.edu
Thu Oct 16 13:15:14 EDT 2003


This is the first one of these I have seen in a while.  I was running a 
program in the python IDE

version:
Python 2.3 (#2, Jul 30 2003, 11:45:28)
[GCC 3.1 20020420 (prerelease)] on darwin

IDE version 1.0.1

and hit Command-period to terminate the program.  I got the following 
exciting result:

**********

Date/Time:  2003-10-16 12:09:58 -0500
OS Version: 10.2.8 (Build 6R73)
Host:       mendenhall.fel.Vanderbilt.Edu

Command:    Python
PID:        9368

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0xf00fcee8

Thread 0 Crashed:
  #0   0x91ac2b5c in InternalDisplayChangedProc
  #1   0x90163230 in __CFRunLoopDoTimer
  #2   0x90148d28 in __CFRunLoopRun
  #3   0x90180f58 in CFRunLoopRunSpecific
  #4   0x969a3b70 in RunCurrentEventLoopInMode
  #5   0x969a41f4 in GetNextEventMatchingMask
  #6   0x969a8054 in WNEInternal
  #7   0x969adf0c in WaitNextEvent
  #8   0x001d8724 in init_Evt
  #9   0x10077090 in call_function (ceval.c:3440)
  #10  0x10074c68 in eval_frame (ceval.c:2117)
  #11  0x10075f80 in PyEval_EvalCodeEx (ceval.c:2663)
  #12  0x10077374 in fast_function (ceval.c:3529)
  #13  0x10077168 in call_function (ceval.c:3458)
  #14  0x10074c68 in eval_frame (ceval.c:2117)
  #15  0x10075f80 in PyEval_EvalCodeEx (ceval.c:2663)
  #16  0x10077374 in fast_function (ceval.c:3529)
  #17  0x10077168 in call_function (ceval.c:3458)
  #18  0x10074c68 in eval_frame (ceval.c:2117)
  #19  0x10075f80 in PyEval_EvalCodeEx (ceval.c:2663)
  #20  0x10077374 in fast_function (ceval.c:3529)
  #21  0x10077168 in call_function (ceval.c:3458)
  #22  0x10074c68 in eval_frame (ceval.c:2117)
  #23  0x10075f80 in PyEval_EvalCodeEx (ceval.c:2663)
  #24  0x10025a1c in function_call (funcobject.c:504)
  #25  0x1000c66c in PyObject_Call (abstract.c:1756)
  #26  0x10015afc in instancemethod_call (classobject.c:2433)
  #27  0x1000c66c in PyObject_Call (abstract.c:1756)
  #28  0x10076f24 in PyEval_CallObjectWithKeywords (ceval.c:3347)
  #29  0x1000edec in PyInstance_New (classobject.c:576)
  #30  0x1000c66c in PyObject_Call (abstract.c:1756)
  #31  0x10077498 in do_call (ceval.c:3644)
  #32  0x10077180 in call_function (ceval.c:3461)
  #33  0x10074c68 in eval_frame (ceval.c:2117)
  #34  0x10075f80 in PyEval_EvalCodeEx (ceval.c:2663)
  #35  0x10078df4 in PyEval_EvalCode (ceval.c:537)
  #36  0x100a9c54 in run_node (pythonrun.c:1206)
  #37  0x100a9400 in PyRun_SimpleFileExFlags (pythonrun.c:805)
  #38  0x100b5bd0 in Py_Main (main.c:415)
  #39  0x00001b5c in 0x1b5c
  #40  0x000019dc in 0x19dc

PPC Thread State:
   srr0: 0x91ac2b5c srr1: 0x0000f030                vrsave: 0x00000000
    xer: 0x20000000   lr: 0x91ac2b48  ctr: 0x91ac2b3c   mq: 0x00000000
     r0: 0x90163230   r1: 0xbfffe200   r2: 0x44024244   r3: 0x000ea020
     r4: 0xf00fcee8   r5: 0x00000000   r6: 0x00000001   r7: 0x00000000
     r8: 0xa0131c4c   r9: 0xa0001048  r10: 0x000449d0  r11: 0xa0132e30
    r12: 0x91ac2b3c  r13: 0x01cce63c  r14: 0x00000000  r15: 0x00000001
    r16: 0x00000000  r17: 0x00000000  r18: 0x24024244  r19: 0x00000000
    r20: 0x00000000  r21: 0x00000000  r22: 0xa1a52b48  r23: 0x000449a8
    r24: 0x00000001  r25: 0xa01330f4  r26: 0x0000139d  r27: 0xae987242
    r28: 0xa0131674  r29: 0x000ea028  r30: 0xa1a5044c  r31: 0x91ac2b48

The only slightly unusual thing about the program is that I was using 
signal handlers, which I haven't done a lot of before.  Here is the 
program, for reference:

from data_acquisition import LabPro_USB
import time
import Numeric
import signal

class mylabpro(LabPro_USB.LabPro_USB):
	def send_string(self, s='s', delay=0.05):
		#print s
		LabPro_USB.LabPro_USB.send_string(self, s, delay)

keep_running=1
create_new_file=0

def handle_SIGINT(signum, frame):
	global keep_running
	keep_running=0

def handle_SIGHUP(signum, frame):
	global create_new_file
	create_new_file=1

def rt_test():
	badloops=0
	logfile=file("datagrab.txt","ab")
	lp=mylabpro(1)
	signal.signal(signal.SIGHUP, handle_SIGHUP)
	signal.signal(signal.SIGINT, handle_SIGINT)
			
	try:	
		try:	
			lp.wake()
			lp.reset()
			print lp.get_system_config() #just to vacuum the connection
			lp.setup_channel(chan=1, operation=1) #set up -10-10 volts readback
			#lp.setup_channel(chan=2, operation=1) #set up -10-10 volts readback
			#lp.setup_channel(chan=3, operation=14) #set up default 0-5
			#lp.setup_channel(chan=4, operation=1) #set up default 0-5
			#lp.setup_channel(chan=21, operation=1) #set up digital
			#lp.setup_channel(chan=22, operation=1) #set up digital
			lp.binary_mode(blocking_factor=1)
			
			samptime=0.101
			lp.setup_data_collection(samptime=samptime, numpoints=-1, rectime=0)
			rtdata=[]
			starttime=time.time()
			laststamp=0.0
			
			while(keep_running):
				time.sleep(0.01)
				newdata=lp.get_data_binary_realtime(channels=1)
				#rtdata+=newdata
				if newdata:
					timestamp=lp.data_timestamp
					fdata=Numeric.array(newdata,Numeric.Float)
					linevolts=lp.scale_binary_data(fdata[:,0],(-10.,10.))
					#feedback=lp.scale_binary_data(fdata[:,1],(-10.,10.))
					timevals=Numeric.add.accumulate(fdata[:,-1])+laststamp
					for i in range(len(newdata)):
						logfile.write("%.3f\t%.4f\t%.3f\n" %
								(timestamp, timevals[i], linevolts[i]))
					laststamp=timevals[-1]
		
			lp.stop()
			newdata=lp.get_data_binary_realtime(channels=1)
				
		finally:
			try:
				logfile.close()
			except:
				pass
			lp.close()

	except:
		import traceback
		traceback.print_exc()
		pass

	signal.signal(signal.SIGHUP, signal.SIG_DFL)
	signal.signal(signal.SIGINT, signal.SIG_DFL)
		
rt_test()

Anyone want to try to trace this down?

Marcus Mendenhall




More information about the Pythonmac-SIG mailing list