<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>debug – Debugging tools for Eventlet — Eventlet 0.13.0 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.13.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="top" title="Eventlet 0.13.0 documentation" href="../index.html" /> <link rel="up" title="Module Reference" href="../modules.html" /> <link rel="next" title="db_pool – DBAPI 2 database connection pooling" href="db_pool.html" /> <link rel="prev" title="corolocal – Coroutine local storage" href="corolocal.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="db_pool.html" title="db_pool – DBAPI 2 database connection pooling" accesskey="N">next</a> |</li> <li class="right" > <a href="corolocal.html" title="corolocal – Coroutine local storage" accesskey="P">previous</a> |</li> <li><a href="../index.html">Eventlet 0.13.0 documentation</a> »</li> <li><a href="../modules.html" accesskey="U">Module Reference</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-eventlet.debug"> <span id="debug-debugging-tools-for-eventlet"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">debug</span></tt> – Debugging tools for Eventlet<a class="headerlink" href="#module-eventlet.debug" title="Permalink to this headline">¶</a></h1> <p>The debug module contains utilities and functions for better debugging Eventlet-powered applications.</p> <dl class="function"> <dt id="eventlet.debug.spew"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">spew</tt><big>(</big><em>trace_names=None</em>, <em>show_values=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.spew" title="Permalink to this definition">¶</a></dt> <dd><p>Install a trace hook which writes incredibly detailed logs about what code is being executed to stdout.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.unspew"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">unspew</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.debug.unspew" title="Permalink to this definition">¶</a></dt> <dd><p>Remove the trace hook installed by spew.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.format_hub_listeners"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">format_hub_listeners</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.debug.format_hub_listeners" title="Permalink to this definition">¶</a></dt> <dd><p>Returns a formatted string of the current listeners on the current hub. This can be useful in determining what’s going on in the event system, especially when used in conjunction with <a class="reference internal" href="#eventlet.debug.hub_listener_stacks" title="eventlet.debug.hub_listener_stacks"><tt class="xref py py-func docutils literal"><span class="pre">hub_listener_stacks()</span></tt></a>.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.format_hub_timers"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">format_hub_timers</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.debug.format_hub_timers" title="Permalink to this definition">¶</a></dt> <dd><p>Returns a formatted string of the current timers on the current hub. This can be useful in determining what’s going on in the event system, especially when used in conjunction with <a class="reference internal" href="#eventlet.debug.hub_timer_stacks" title="eventlet.debug.hub_timer_stacks"><tt class="xref py py-func docutils literal"><span class="pre">hub_timer_stacks()</span></tt></a>.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.hub_listener_stacks"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_listener_stacks</tt><big>(</big><em>state=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_listener_stacks" title="Permalink to this definition">¶</a></dt> <dd><p>Toggles whether or not the hub records the stack when clients register listeners on file descriptors. This can be useful when trying to figure out what the hub is up to at any given moment. To inspect the stacks of the current listeners, call <a class="reference internal" href="#eventlet.debug.format_hub_listeners" title="eventlet.debug.format_hub_listeners"><tt class="xref py py-func docutils literal"><span class="pre">format_hub_listeners()</span></tt></a> at critical junctures in the application logic.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.hub_exceptions"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_exceptions</tt><big>(</big><em>state=True</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_exceptions" title="Permalink to this definition">¶</a></dt> <dd><p>Toggles whether the hub prints exceptions that are raised from its timers. This can be useful to see how greenthreads are terminating.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.tpool_exceptions"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">tpool_exceptions</tt><big>(</big><em>state=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.tpool_exceptions" title="Permalink to this definition">¶</a></dt> <dd><p>Toggles whether tpool itself prints exceptions that are raised from functions that are executed in it, in addition to raising them like it normally does.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.hub_prevent_multiple_readers"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_prevent_multiple_readers</tt><big>(</big><em>state=True</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_prevent_multiple_readers" title="Permalink to this definition">¶</a></dt> <dd><p>Toggle prevention of multiple greenlets reading from a socket</p> <p>When multiple greenlets read from the same socket it is often hard to predict which greenlet will receive what data. To achieve resource sharing consider using <tt class="docutils literal"><span class="pre">eventlet.pools.Pool</span></tt> instead.</p> <p>But if you really know what you are doing you can change the state to <tt class="docutils literal"><span class="pre">False</span></tt> to stop the hub from protecting against this mistake.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.hub_timer_stacks"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_timer_stacks</tt><big>(</big><em>state=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_timer_stacks" title="Permalink to this definition">¶</a></dt> <dd><p>Toggles whether or not the hub records the stack when timers are set. To inspect the stacks of the current timers, call <a class="reference internal" href="#eventlet.debug.format_hub_timers" title="eventlet.debug.format_hub_timers"><tt class="xref py py-func docutils literal"><span class="pre">format_hub_timers()</span></tt></a> at critical junctures in the application logic.</p> </dd></dl> <dl class="function"> <dt id="eventlet.debug.hub_blocking_detection"> <tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_blocking_detection</tt><big>(</big><em>state=False</em>, <em>resolution=1</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_blocking_detection" title="Permalink to this definition">¶</a></dt> <dd><p>Toggles whether Eventlet makes an effort to detect blocking behavior in an application.</p> <p>It does this by telling the kernel to raise a SIGALARM after a short timeout, and clearing the timeout every time the hub greenlet is resumed. Therefore, any code that runs for a long time without yielding to the hub will get interrupted by the blocking detector (don’t use it in production!).</p> <p>The <em>resolution</em> argument governs how long the SIGALARM timeout waits in seconds. If on Python 2.6 or later, the implementation uses <a class="reference external" href="http://docs.python.org/library/signal.html#signal.setitimer" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">signal.setitimer()</span></tt></a> and can be specified as a floating-point value. On 2.5 or earlier, 1 second is the minimum. The shorter the resolution, the greater the chance of false positives.</p> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="corolocal.html" title="previous chapter"><tt class="docutils literal"><span class="pre">corolocal</span></tt> – Coroutine local storage</a></p> <h4>Next topic</h4> <p class="topless"><a href="db_pool.html" title="next chapter"><tt class="docutils literal"><span class="pre">db_pool</span></tt> – DBAPI 2 database connection pooling</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/modules/debug.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="db_pool.html" title="db_pool – DBAPI 2 database connection pooling" >next</a> |</li> <li class="right" > <a href="corolocal.html" title="corolocal – Coroutine local storage" >previous</a> |</li> <li><a href="../index.html">Eventlet 0.13.0 documentation</a> »</li> <li><a href="../modules.html" >Module Reference</a> »</li> </ul> </div> <div class="footer"> © Copyright 2005-2010, Eventlet Contributors. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>