searching for a segfault when visited by apple computers :)

This commit is contained in:
Stefan Kögl 2014-04-17 01:55:00 +02:00
parent 2b78252fc3
commit de19433571
1 changed files with 30 additions and 22 deletions

View File

@ -138,18 +138,23 @@ class OSCThread(threading.Thread):
while self.running: while self.running:
try: try:
reads, writes, errs = select.select([self.osc_sock], [], [], 0.05) reads, writes, errs = select.select([self.osc_sock], [], [], 0.05)
except select.error: except Exception, e:
print "select error", e
pass pass
else:
if reads: if reads:
osc_input = self.osc_sock.recv(256) try:
osc_input, address = self.osc_sock.recvfrom(8192)
osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input)) osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input))
#print "thread osc_address", osc_address
if osc_address.find("ekg") != -1 or osc_address.find("plot") != -1: if osc_address.find("ekg") != -1 or osc_address.find("plot") != -1:
queue.put_nowait((osc_address, messages)) queue.put_nowait((osc_address, messages))
except Exception, e:
print "recvfrom error", e
else: else:
queue.put_nowait(("/bjoern/ekg", [0])) queue.put_nowait(("/bjoern/ekg", [0]))
queue.put_nowait(("/merle/ekg", [0])) queue.put_nowait(("/merle/ekg", [0]))
queue.put_nowait(("/uwe/ekg", [0])) queue.put_nowait(("/uwe/ekg", [0]))
self.unsubscribe_me() self.unsubscribe_me()
print "OSCThread is going down" print "OSCThread is going down"
@ -377,7 +382,7 @@ class MyHandler(BaseHTTPRequestHandler):
osc_address, args = queue.get_nowait() osc_address, args = queue.get_nowait()
except Queue.Empty: except Queue.Empty:
break break
else:
plotter.update(osc_address, args[0]) plotter.update(osc_address, args[0])
exporter = pg.exporters.ImageExporter.ImageExporter(plotter.plot.plotItem) exporter = pg.exporters.ImageExporter.ImageExporter(plotter.plot.plotItem)
@ -418,11 +423,14 @@ class MyHandler(BaseHTTPRequestHandler):
self.thread.join() self.thread.join()
del self.thread del self.thread
except IOError, e: except IOError, e:
print "ioerror", e, e[0]
print dir(e)
if e[0] == 32:
if hasattr(self, "thread"): if hasattr(self, "thread"):
self.thread.running = False self.thread.running = False
self.thread.join() self.thread.join()
del self.thread del self.thread
print "ioerror", e else:
print '-'*40 print '-'*40
print 'Exception happened during processing of request from' print 'Exception happened during processing of request from'
traceback.print_exc() # XXX But this goes to stderr! traceback.print_exc() # XXX But this goes to stderr!