- ***************************************************************************
- Crash traceback:
- ---------------------------------------------------------------------------
- KeyboardInterrupt Python 2.6.6: /home/ben/dev/ve/ticket-manager/bin/python
- Mon Aug 1 12:21:42 2011
- A problem occured executing Python code. Here is the sequence of function
- calls leading up to the error, with the most recent (innermost) call last.
- /usr/lib/python2.6/atexit.pyc in _run_exitfuncs()
- 9
- 10 import sys
- 11
- 12 _exithandlers = []
- 13 def _run_exitfuncs():
- 14 """run any registered exit functions
- 15
- 16 _exithandlers is traversed in reverse order so functions are executed
- 17 last in, first out.
- 18 """
- 19
- 20 exc_info = None
- 21 while _exithandlers:
- 22 func, targs, kargs = _exithandlers.pop()
- 23 try:
- ---> 24 func(*targs, **kargs)
- func = <function shutdown at 0x97d54c4>
- global function = undefined
- global to = undefined
- global be = undefined
- global called = undefined
- global at = undefined
- global exit = undefined
- 25 except SystemExit:
- 26 exc_info = sys.exc_info()
- 27 except:
- 28 import traceback
- 29 print >> sys.stderr, "Error in atexit._run_exitfuncs:"
- 30 traceback.print_exc()
- 31 exc_info = sys.exc_info()
- 32
- 33 if exc_info is not None:
- 34 raise exc_info[0], exc_info[1], exc_info[2]
- 35
- 36
- 37 def register(func, *targs, **kargs):
- 38 """register a function to be executed upon normal program termination
- 39
- /home/ben/dev/ve/ticket-manager/lib/python2.6/site-packages/ipython-0.11-py2.6.egg/IPython/core/history.pyc in stop(self=<HistorySavingThread(Thread-1, started -1221960848)>)
- 483 return
- 484 self.history_manager.save_flag.clear()
- 485 self.history_manager.writeout_cache(self.db)
- 486 except Exception as e:
- 487 print(("The history saving thread hit an unexpected error (%s)."
- 488 "History will not be written to the database.") % repr(e))
- 489
- 490 def stop(self):
- 491 """This can be called from the main thread to safely stop this thread.
- 492
- 493 Note that it does not attempt to write out remaining history before
- 494 exiting. That should be done by calling the HistoryManager's
- 495 end_session method."""
- 496 self.stop_now = True
- 497 self.history_manager.save_flag.set()
- --> 498 self.join()
- 499
- 500
- 501 # To match, e.g. ~5/8-~2/3
- 502 range_re = re.compile(r"""
- 503 ((?P<startsess>~?\d+)/)?
- 504 (?P<start>\d+) # Only the start line num is compulsory
- 505 ((?P<sep>[\-:])
- 506 ((?P<endsess>~?\d+)/)?
- 507 (?P<end>\d+))?
- 508 $""", re.VERBOSE)
- 509
- 510 def extract_hist_ranges(ranges_str):
- 511 """Turn a string of history ranges into 3-tuples of (session, start, stop).
- 512
- 513 Examples
- /usr/lib/python2.6/threading.pyc in join(self=<HistorySavingThread(Thread-1, started -1221960848)>, timeout=None)
- 629 def join(self, timeout=None):
- 630 if not self.__initialized:
- 631 raise RuntimeError("Thread.__init__() not called")
- 632 if not self.__started.is_set():
- 633 raise RuntimeError("cannot join thread before it is started")
- 634 if self is current_thread():
- 635 raise RuntimeError("cannot join current thread")
- 636
- 637 if __debug__:
- 638 if not self.__stopped:
- 639 self._note("%s.join(): waiting until thread stops", self)
- 640 self.__block.acquire()
- 641 try:
- 642 if timeout is None:
- 643 while not self.__stopped:
- --> 644 self.__block.wait()
- 645 if __debug__:
- 646 self._note("%s.join(): thread stopped", self)
- 647 else:
- 648 deadline = _time() + timeout
- 649 while not self.__stopped:
- 650 delay = deadline - _time()
- 651 if delay <= 0:
- 652 if __debug__:
- 653 self._note("%s.join(): timed out", self)
- 654 break
- 655 self.__block.wait(delay)
- 656 else:
- 657 if __debug__:
- 658 self._note("%s.join(): thread stopped", self)
- 659 finally:
- /usr/lib/python2.6/threading.pyc in wait(self=<Condition(<thread.lock object at 0xb77214e0>, 1)>, timeout=None)
- 224 if self.__lock.acquire(0):
- 225 self.__lock.release()
- 226 return False
- 227 else:
- 228 return True
- 229
- 230 def wait(self, timeout=None):
- 231 if not self._is_owned():
- 232 raise RuntimeError("cannot wait on un-acquired lock")
- 233 waiter = _allocate_lock()
- 234 waiter.acquire()
- 235 self.__waiters.append(waiter)
- 236 saved_state = self._release_save()
- 237 try: # restore state no matter what (e.g., KeyboardInterrupt)
- 238 if timeout is None:
- --> 239 waiter.acquire()
- global allocate_lockR0 = undefined
- global t = undefined
- global get_identR9 = undefined
- global errort = undefined
- global ThreadErrort = undefined
- global filterwarningst = undefined
- global DeprecationWarningRQ = undefined
- global R = undefined
- global objectR = undefined
- 240 if __debug__:
- 241 self._note("%s.wait(): got it", self)
- 242 else:
- 243 # Balancing act: We can't afford a pure busy loop, so we
- 244 # have to sleep; but if we sleep the whole timeout time,
- 245 # we'll be unresponsive. The scheme here sleeps very
- 246 # little at first, longer as time goes on, but never longer
- 247 # than 20 times per second (or the timeout time remaining).
- 248 endtime = _time() + timeout
- 249 delay = 0.0005 # 500 us -> initial delay of 1 ms
- 250 while True:
- 251 gotit = waiter.acquire(0)
- 252 if gotit:
- 253 break
- 254 remaining = endtime - _time()
- /home/ben/dev/ve/ticket-manager/src/eventlet/eventlet/semaphore.pyc in acquire(self=<Semaphore at 0xa2abeec c=0 _w[0]>, blocking=True)
- 56 which blocked threads are awakened should not be relied on. There is no
- 57 return value in this case.
- 58
- 59 When invoked with blocking set to true, do the same thing as when called
- 60 without arguments, and return true.
- 61
- 62 When invoked with blocking set to false, do not block. If a call without
- 63 an argument would block, return false immediately; otherwise, do the
- 64 same thing as when called without arguments, and return true."""
- 65 if not blocking and self.locked():
- 66 return False
- 67 if self.counter <= 0:
- 68 self._waiters.add(greenthread.getcurrent())
- 69 try:
- 70 while self.counter <= 0:
- ---> 71 hubs.get_hub().switch()
- global The = undefined
- blocking = True
- global argument = undefined
- global consistency = undefined
- global CappedSemaphore = <class 'eventlet.semaphore.CappedSemaphore'>
- 72 finally:
- 73 self._waiters.discard(greenthread.getcurrent())
- 74 self.counter -= 1
- 75 return True
- 76
- 77 def __enter__(self):
- 78 self.acquire()
- 79
- 80 def release(self, blocking=True):
- 81 """Release a semaphore, incrementing the internal counter by one. When
- 82 it was zero on entry and another thread is waiting for it to become
- 83 larger than zero again, wake up that thread.
- 84
- 85 The *blocking* argument is for consistency with CappedSemaphore and is
- 86 ignored"""
- /home/ben/dev/ve/ticket-manager/src/eventlet/eventlet/hubs/hub.pyc in switch(self=<eventlet.hubs.epolls.Hub object>)
- 162 assert cur is not self.greenlet, 'Cannot switch to MAINLOOP from MAINLOOP'
- 163 switch_out = getattr(cur, 'switch_out', None)
- 164 if switch_out is not None:
- 165 try:
- 166 switch_out()
- 167 except:
- 168 self.squelch_generic_exception(sys.exc_info())
- 169 if self.greenlet.dead:
- 170 self.greenlet = greenlet.greenlet(self.run)
- 171 try:
- 172 if self.greenlet.parent is not cur:
- 173 cur.parent = self.greenlet
- 174 except ValueError:
- 175 pass # gets raised if there is a greenlet parent cycle
- 176 clear_sys_exc_info()
- --> 177 return self.greenlet.switch()
- 178
- 179 def squelch_exception(self, fileno, exc_info):
- 180 traceback.print_exception(*exc_info)
- 181 sys.stderr.write("Removing descriptor: %r\n" % (fileno,))
- 182 sys.stderr.flush()
- 183 try:
- 184 self.remove_descriptor(fileno)
- 185 except Exception, e:
- 186 sys.stderr.write("Exception while removing descriptor! %r\n" % (e,))
- 187 sys.stderr.flush()
- 188
- 189 def wait(self, seconds=None):
- 190 raise NotImplementedError("Implement this in a subclass")
- 191
- 192 def default_sleep(self):
- /home/ben/dev/ve/ticket-manager/src/eventlet/eventlet/hubs/hub.pyc in run(self=<eventlet.hubs.epolls.Hub object>, *a=(), **kw={})
- 211 self.stopping = False
- 212 while not self.stopping:
- 213 self.prepare_timers()
- 214 if self.debug_blocking:
- 215 self.block_detect_pre()
- 216 self.fire_timers(self.clock())
- 217 if self.debug_blocking:
- 218 self.block_detect_post()
- 219 self.prepare_timers()
- 220 wakeup_when = self.sleep_until()
- 221 if wakeup_when is None:
- 222 sleep_time = self.default_sleep()
- 223 else:
- 224 sleep_time = wakeup_when - self.clock()
- 225 if sleep_time > 0:
- --> 226 self.wait(sleep_time)
- 227 else:
- 228 self.wait(0)
- 229 else:
- 230 self.timers_canceled = 0
- 231 del self.timers[:]
- 232 del self.next_timers[:]
- 233 finally:
- 234 self.running = False
- 235 self.stopping = False
- 236
- 237 def abort(self, wait=False):
- 238 """Stop the runloop. If run is executing, it will exit after
- 239 completing the next runloop iteration.
- 240
- 241 Set *wait* to True to cause abort to switch to the hub immediately and
- /home/ben/dev/ve/ticket-manager/src/eventlet/eventlet/hubs/poll.pyc in wait(self=<eventlet.hubs.epolls.Hub object>, seconds=60.0)
- 66 except (KeyError, ValueError, IOError, OSError):
- 67 # raised if we try to remove a fileno that was
- 68 # already removed/invalid
- 69 pass
- 70
- 71 def do_poll(self, seconds):
- 72 # poll.poll expects integral milliseconds
- 73 return self.poll.poll(int(seconds * 1000.0))
- 74
- 75 def wait(self, seconds=None):
- 76 readers = self.listeners[READ]
- 77 writers = self.listeners[WRITE]
- 78
- 79 if not readers and not writers:
- 80 if seconds:
- ---> 81 sleep(seconds)
- 82 return
- 83 try:
- 84 presult = self.do_poll(seconds)
- 85 except (IOError, select.error), e:
- 86 if get_errno(e) == errno.EINTR:
- 87 return
- 88 raise
- 89 SYSTEM_EXCEPTIONS = self.SYSTEM_EXCEPTIONS
- 90
- 91 if self.debug_blocking:
- 92 self.block_detect_pre()
- 93
- 94 for fileno, event in presult:
- 95 try:
- 96 if event & READ_MASK:
- KeyboardInterrupt:
- ***************************************************************************