Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Interrupt Evaluation

2009-07-27
2013-03-15
  • Nikolaus Rath
    Nikolaus Rath
    2009-07-27

    Hello,

    I have a program that hangs at some point. Is there a way to interrupt the evaluation and go into debugging mode to see where it got stuck?

    Randomly setting breakpoints (or debug messages) to slowly narrow down this point seems like a very uneccessarily inconvenience.

     
    • Fabio Zadrozny
      Fabio Zadrozny
      2009-07-27

      You can do it if you start in debug mode and later press the pause button (at the debug view, select the thread you want to pause).

      Cheers,

      Fabio

       
    • Nikolaus Rath
      Nikolaus Rath
      2009-07-29

      I'm afraid this does not seem to work for me. Pressing the pause button (you mean the button labelled 'suspend' between 'resume' and 'terminate', right?) does not seem to have any effect at all. Could you try it with the following testcase?

      import threading
      import time

      lock = threading.RLock()

      def run1():
          print 'Thread 1 acquiring lock...'
          lock.acquire()
          print 'Thread 1 holding lock'
          time.sleep(120)
          lock.release()
          print 'Thread 1 released lock'
         
      def run2():
          time.sleep(1)
          print 'Thread 2 acquiring lock'
          lock.acquire()
          print 'Thread 2 got lock'
          lock.release()
          print 'Thread 2 released lock'
         
      t1 = threading.Thread(target=run1)
      t2 = threading.Thread(target=run2)
         
      t1.start()
      t2.start()

      t1.join()
      t2.join()

      Thanks!
      Nikolaus

       
    • Nikolaus Rath
      Nikolaus Rath
      2009-07-29

      Seems that sf has eaten the indentation in the run1 and run2 functions... JFTR record, I tested it with correct indentation.