<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 08/21/2012 03:49 PM,
      <a class="moz-txt-link-abbreviated" href="mailto:michel.gauthier@bull.net">michel.gauthier@bull.net</a> wrote:<br>
    </div>
    <blockquote
cite="mid:OF22039CE3.CCCA89B6-ONC1257A61.004A4033-C1257A61.004BE7D3@bull.net"
      type="cite"><font size="2" face="sans-serif">I have installed
        winpdb, but I have still
        a problem while debugging nova-scheduler service : </font>
      <br>
      <br>
      <font size="2" face="sans-serif">on </font><tt><font size="2">eventlet.monkey_patch()</font></tt><font
        size="2" face="sans-serif">
        instruction, the debugger get the following exception :</font>
      <br>
      <br>
      <br>
      <font size="2" face="sans-serif">on winpdb GUI session ( launched
        thru
        : winpdb command and then atteched to the debugee session)</font>
      <br>
      <font size="2" face="sans-serif">Exception in thread Thread-57:</font>
      <br>
      <font size="2" face="sans-serif">Traceback (most recent call
        last):</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/lib/python2.7/threading.py",
        line 551, in __bootstrap_inner</font>
      <br>
      <font size="2" face="sans-serif">    self.run()</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/lib/python2.7/threading.py",
        line 504, in run</font>
      <br>
      <font size="2" face="sans-serif">    self.__target(*self.__args,
        **self.__kwargs)</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/local/lib/python2.7/dist-packages/rpdb2.py",
        line 10790, in __event_monitor_proc</font>
      <br>
      <font size="2" face="sans-serif">    (n, sel) =
        self.getSession().getProxy().wait_for_event(PING_TIMEOUT,
        self.m_remote_event_index)</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/lib/python2.7/xmlrpclib.py",
        line 1224, in __call__</font>
      <br>
      <font size="2" face="sans-serif">    return
        self.__send(self.__name,
        args)</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/local/lib/python2.7/dist-packages/rpdb2.py",
        line 9520, in __request</font>
      <br>
      <font size="2" face="sans-serif">    raise _e</font>
      <br>
      <font size="2" face="sans-serif">RuntimeError: cannot release
        un-acquired
        lock</font>
      <br>
      <br>
      <br>
      <font size="2" face="sans-serif">on winpdb debugee session
        (launched
        thru : winpdb -d /usr/bin/nova-scheduler
        --flagfile=/etc/nova/nova.conf
        command)</font>
      <br>
      <font size="2" face="sans-serif">Exception in thread
        __worker_target:</font>
      <br>
      <font size="2" face="sans-serif">Traceback (most recent call
        last):</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/lib/python2.7/threading.py",
        line 551, in __bootstrap_inner</font>
      <br>
      <font size="2" face="sans-serif">    self.run()</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/local/lib/python2.7/dist-packages/rpdb2.py",
        line 4574, in run</font>
      <br>
      <font size="2" face="sans-serif">    threading.Thread.run(self)</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/lib/python2.7/threading.py",
        line 504, in run</font>
      <br>
      <font size="2" face="sans-serif">    self.__target(*self.__args,
        **self.__kwargs)</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/local/lib/python2.7/dist-packages/rpdb2.py",
        line 9361, in __worker_target</font>
      <br>
      <font size="2" face="sans-serif">    self.m_lock.release()</font>
      <br>
      <font size="2" face="sans-serif">  File
        "/usr/lib/python2.7/threading.py",
        line 142, in release</font>
      <br>
      <font size="2" face="sans-serif">    raise RuntimeError("cannot
        release un-acquired lock")</font>
      <br>
      <font size="2" face="sans-serif">RuntimeError: cannot release
        un-acquired
        lock</font>
      <br>
      <br>
      <br>
      <font size="2" face="sans-serif">Help for a solution.</font>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <font size="1" face="sans-serif" color="#5f5f5f">De :      
         </font><font size="1" face="sans-serif">Michael J Fork
        <a class="moz-txt-link-rfc2396E" href="mailto:mjfork@us.ibm.com"><mjfork@us.ibm.com></a></font>
      <br>
      <font size="1" face="sans-serif" color="#5f5f5f">A :      
         </font><font size="1" face="sans-serif">OpenStack Development
        Mailing List <a class="moz-txt-link-rfc2396E" href="mailto:openstack-dev@lists.openstack.org"><openstack-dev@lists.openstack.org></a></font>
      <br>
      <font size="1" face="sans-serif" color="#5f5f5f">Date :      
         </font><font size="1" face="sans-serif">17/08/2012 15:03</font>
      <br>
      <font size="1" face="sans-serif" color="#5f5f5f">Objet :    
           </font><font size="1" face="sans-serif">Re: [openstack-dev]
        Problem with debugging program        having
               eventlet.monkey_patch() code</font>
      <br>
      <hr noshade="noshade">
      <br>
      <br>
      <br>
      <font size="2" face="sans-serif">We have found that Winpdb (</font><a
        moz-do-not-send="true" href="http://winpdb.org/"><font size="2"
          face="sans-serif" color="blue"><u>http://winpdb.org/</u></font></a><font
        size="2" face="sans-serif">
        - platform independent despite Win in the name) works well with
        multi-threaded
        Python.  While using PyDev for development, run Winpdb as a
        remote
        debugger for the multithreaded service.  Flow is like this:</font><font
        size="3"><br>
      </font><font size="2" face="sans-serif"><br>
        Launch Winpdb GUI<br>
        # winpdb</font><font size="3"><br>
      </font><font size="2" face="sans-serif"><br>
        Start Debugging <br>
        # cd /home/openstack-dev/workspace/nova/bin <br>
        # winpdb -d -r <file_to_debug> <br>
        Set Password: openstack </font><font size="3"><br>
      </font><font size="2" face="sans-serif"><br>
        Attach to Process<br>
        1) In Winpdb GUI, select File -> Attach<br>
        2) Enter password from step 4, should display files associated
        with that
        password <br>
        3) Select process/file then select OK <br>
         <br>
        To Stop Debug or Make Changes and Restart <br>
        1) File -> Stop to detach current debugger <br>
        2) Make changes in Eclipse and Save (make sure development user
        has write
        privileges to repository) <br>
        3) kill and restart winpdb debugging process started above<br>
        4) Re-attach to the process in the Winpdb GUI<br>
        <br>
        Michael<br>
        <br>
        -------------------------------------------------<br>
        Michael Fork<br>
        Cloud Architect, Emerging Solutions<br>
        IBM Systems & Technology Group</font><font size="3"><br>
      </font><tt><font size="2"><br>
          <a class="moz-txt-link-abbreviated" href="mailto:michel.gauthier@bull.net">michel.gauthier@bull.net</a> wrote on 08/17/2012 07:59:18 AM:<br>
          <br>
          > From: <a class="moz-txt-link-abbreviated" href="mailto:michel.gauthier@bull.net">michel.gauthier@bull.net</a><br>
          > To: <a class="moz-txt-link-abbreviated" href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>, <br>
          > Date: 08/17/2012 08:02 AM<br>
          > Subject: [openstack-dev] Problem with debugging program
          having <br>
          > eventlet.monkey_patch() code<br>
          > <br>
          > Hi all, <br>
          > I want to debug nova-scheduler service (Essex version)
           code
          with <br>
          > Eclipse->Pydev->Debug Configuration. <br>
          > But when I launch it under Debug Configuration, I get the
          following
          <br>
          > error messages : <br>
          > <br>
          > pydev debugger: starting <br>
          > Traceback (most recent call last): <br>
          >   File
          "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py",
          line<br>
          > 336, in fire_timers <br>
          >     timer() <br>
          >   File
          "/usr/lib/python2.7/dist-packages/eventlet/hubs/timer.py",
          <br>
          > line 56, in __call__ <br>
          >     cb(*args, **kw) <br>
          >   File
          "/usr/lib/python2.7/dist-packages/eventlet/semaphore.py",
          <br>
          > line 95, in _do_acquire <br>
          >     waiter.switch() <br>
          > error: cannot switch to a different thread <br>
          > <br>
          > and then, Pydev debugger does not work! <br>
          > <br>
          > In fact, these errors are due to the use of
          eventlet.monkey_patch()
          inside <br>
          > nova-scheduler launcher (as well as inside other nova-*
          launchers).
          <br>
          > <br>
          > Do you have any ideas to resolve this problem? <br>
          > <br>
          > Thanks in
          advance._______________________________________________<br>
          > OpenStack-dev mailing list<br>
          > <a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
          > </font></tt><a moz-do-not-send="true"
        href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev"><tt><font
            size="2" color="blue"><u>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</u></font></tt></a><tt><font
          size="2">_______________________________________________<br>
          OpenStack-dev mailing list<br>
          <a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
        </font></tt><a moz-do-not-send="true"
        href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev"><tt><font
            size="2">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</font></tt></a><tt><font
          size="2"><br>
        </font></tt>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
OpenStack-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
    </blockquote>
    As a quick workaround you can change monkey patching at
    nova-scheduler script:<br>
    <br>
     eventlet.monkey_patch(thread=False)<br>
    <br>
    HTH<br>
  </body>
</html>