Skip to content

Instantly share code, notes, and snippets.

@blinsay
Created January 8, 2012 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blinsay/1580110 to your computer and use it in GitHub Desktop.
Save blinsay/1580110 to your computer and use it in GitHub Desktop.
Do you really want to exit ([y]/n)? y
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.6/site-packages/IPython/core/history.py", line 498, in stop
self.join()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 634, in join
self.__block.wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 237, in wait
waiter.acquire()
File "/Library/Python/2.6/site-packages/eventlet/semaphore.py", line 71, in acquire
hubs.get_hub().switch()
File "/Library/Python/2.6/site-packages/eventlet/hubs/hub.py", line 177, in switch
return self.greenlet.switch()
File "/Library/Python/2.6/site-packages/eventlet/hubs/hub.py", line 226, in run
self.wait(sleep_time)
File "/Library/Python/2.6/site-packages/eventlet/hubs/selects.py", line 32, in wait
time.sleep(seconds)
KeyboardInterrupt
Error in sys.exitfunc:
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (5, 0))
---------------------------------------------------------------------------
KeyboardInterrupt Python 2.6.1: /usr/bin/python
Sun Jan 8 18:30:35 2012
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.
/System/Library/Frameworks/Python.framework/Versions/2.6/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 0x100664f50>
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
/Library/Python/2.6/site-packages/IPython/core/history.pyc in stop(self=<HistorySavingThread(Thread-1, started 4317536256)>)
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
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.pyc in join(self=<HistorySavingThread(Thread-1, started 4317536256)>, timeout=None)
619 def join(self, timeout=None):
620 if not self.__initialized:
621 raise RuntimeError("Thread.__init__() not called")
622 if not self.__started.is_set():
623 raise RuntimeError("cannot join thread before it is started")
624 if self is current_thread():
625 raise RuntimeError("cannot join current thread")
626
627 if __debug__:
628 if not self.__stopped:
629 self._note("%s.join(): waiting until thread stops", self)
630 self.__block.acquire()
631 try:
632 if timeout is None:
633 while not self.__stopped:
--> 634 self.__block.wait()
635 if __debug__:
636 self._note("%s.join(): thread stopped", self)
637 else:
638 deadline = _time() + timeout
639 while not self.__stopped:
640 delay = deadline - _time()
641 if delay <= 0:
642 if __debug__:
643 self._note("%s.join(): timed out", self)
644 break
645 self.__block.wait(delay)
646 else:
647 if __debug__:
648 self._note("%s.join(): thread stopped", self)
649 finally:
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.pyc in wait(self=<Condition(<thread.lock object at 0x1004b3348>, 1)>, timeout=None)
222 if self.__lock.acquire(0):
223 self.__lock.release()
224 return False
225 else:
226 return True
227
228 def wait(self, timeout=None):
229 if not self._is_owned():
230 raise RuntimeError("cannot wait on un-aquired lock")
231 waiter = _allocate_lock()
232 waiter.acquire()
233 self.__waiters.append(waiter)
234 saved_state = self._release_save()
235 try: # restore state no matter what (e.g., KeyboardInterrupt)
236 if timeout is None:
--> 237 waiter.acquire()
global R = undefined
global t = undefined
global _shutdownR = undefined
global _threading_localR = undefined
global sS = undefined
global System = undefined
global Library = undefined
global Frameworks = undefined
global Python.framework = undefined
global Versions = undefined
global lib = undefined
global python2 = undefined
global threading.pyt = undefined
global module = undefined
global s = undefined
global K = undefined
global u = undefined
238 if __debug__:
239 self._note("%s.wait(): got it", self)
240 else:
241 # Balancing act: We can't afford a pure busy loop, so we
242 # have to sleep; but if we sleep the whole timeout time,
243 # we'll be unresponsive. The scheme here sleeps very
244 # little at first, longer as time goes on, but never longer
245 # than 20 times per second (or the timeout time remaining).
246 endtime = _time() + timeout
247 delay = 0.0005 # 500 us -> initial delay of 1 ms
248 while True:
249 gotit = waiter.acquire(0)
250 if gotit:
251 break
252 remaining = endtime - _time()
/Library/Python/2.6/site-packages/eventlet/semaphore.pyc in acquire(self=<Semaphore at 0x1026b8e10 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"""
/Library/Python/2.6/site-packages/eventlet/hubs/hub.pyc in switch(self=<eventlet.hubs.selects.Hub object at 0x102760850>)
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):
/Library/Python/2.6/site-packages/eventlet/hubs/hub.pyc in run(self=<eventlet.hubs.selects.Hub object at 0x102760850>, *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
/Library/Python/2.6/site-packages/eventlet/hubs/selects.pyc in wait(self=<eventlet.hubs.selects.Hub object at 0x102760850>, seconds=60.0)
17 """ Iterate through fds, removing the ones that are bad per the
18 operating system.
19 """
20 for fd in self.listeners[READ].keys() + self.listeners[WRITE].keys():
21 try:
22 select.select([fd], [], [], 0)
23 except select.error, e:
24 if get_errno(e) in BAD_SOCK:
25 self.remove_descriptor(fd)
26
27 def wait(self, seconds=None):
28 readers = self.listeners[READ]
29 writers = self.listeners[WRITE]
30 if not readers and not writers:
31 if seconds:
---> 32 time.sleep(seconds)
33 return
34 try:
35 r, w, er = select.select(readers.keys(), writers.keys(), readers.keys() + writers.keys(), seconds)
36 except select.error, e:
37 if get_errno(e) == errno.EINTR:
38 return
39 elif get_errno(e) in BAD_SOCK:
40 self._remove_bad_fds()
41 return
42 else:
43 raise
44
45 for fileno in er:
46 readers.get(fileno, noop).cb(fileno)
47 writers.get(fileno, noop).cb(fileno)
KeyboardInterrupt:
**********************************************************************
Oops, ipython crashed. We do our best to make it stable, but...
A crash report was automatically generated with the following information:
- A verbatim copy of the crash traceback.
- A copy of your input history during this session.
- Data on your current ipython configuration.
It was left in the file named:
'/Users/benl/.ipython/Crash_report_ipython.txt'
If you can email this file to the developers, the information in it will help
them in understanding and correcting the problem.
You can mail it to: Fernando Perez at fperez.net@gmail.com
with the subject 'ipython Crash Report'.
If you want to do it now, the following command will work (under Unix):
mail -s 'ipython Crash Report' fperez.net@gmail.com < /Users/benl/.ipython/Crash_report_ipython.txt
To ensure accurate tracking of this issue, please file a report about it at:
http://github.com/ipython/ipython/issues
Hit <Enter> to quit this message (your terminal may close):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment