deb-python-eventlet/doc/modules/debug.html

222 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 &#8212; Eventlet 0.21.0 documentation</title>
<link rel="stylesheet" href="../_static/classic.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.21.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</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="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="db_pool DBAPI 2 database connection pooling" href="db_pool.html" />
<link rel="prev" title="dagpool Dependency-Driven Greenthreads" href="dagpool.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<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="dagpool.html" title="dagpool Dependency-Driven Greenthreads"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.21.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &#187;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-eventlet.debug">
<span id="debug-debugging-tools-for-eventlet"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">debug</span></code> &#8211; 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">
<code class="descclassname">eventlet.debug.</code><code class="descname">spew</code><span class="sig-paren">(</span><em>trace_names=None</em>, <em>show_values=False</em><span class="sig-paren">)</span><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">
<code class="descclassname">eventlet.debug.</code><code class="descname">unspew</code><span class="sig-paren">(</span><span class="sig-paren">)</span><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">
<code class="descclassname">eventlet.debug.</code><code class="descname">format_hub_listeners</code><span class="sig-paren">(</span><span class="sig-paren">)</span><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&#8217;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"><code class="xref py py-func docutils literal"><span class="pre">hub_listener_stacks()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.format_hub_timers">
<code class="descclassname">eventlet.debug.</code><code class="descname">format_hub_timers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><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&#8217;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"><code class="xref py py-func docutils literal"><span class="pre">hub_timer_stacks()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_listener_stacks">
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_listener_stacks</code><span class="sig-paren">(</span><em>state=False</em><span class="sig-paren">)</span><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"><code class="xref py py-func docutils literal"><span class="pre">format_hub_listeners()</span></code></a> at critical
junctures in the application logic.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_exceptions">
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_exceptions</code><span class="sig-paren">(</span><em>state=True</em><span class="sig-paren">)</span><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">
<code class="descclassname">eventlet.debug.</code><code class="descname">tpool_exceptions</code><span class="sig-paren">(</span><em>state=False</em><span class="sig-paren">)</span><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">
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_prevent_multiple_readers</code><span class="sig-paren">(</span><em>state=True</em><span class="sig-paren">)</span><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 <code class="docutils literal"><span class="pre">eventlet.pools.Pool</span></code> instead.</p>
<p>But if you really know what you are doing you can change the state
to <code class="docutils literal"><span class="pre">False</span></code> to stop the hub from protecting against this mistake.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_timer_stacks">
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_timer_stacks</code><span class="sig-paren">(</span><em>state=False</em><span class="sig-paren">)</span><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"><code class="xref py py-func docutils literal"><span class="pre">format_hub_timers()</span></code></a>
at critical junctures in the application logic.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_blocking_detection">
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_blocking_detection</code><span class="sig-paren">(</span><em>state=False</em>, <em>resolution=1</em><span class="sig-paren">)</span><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&#8217;t use it in production!).</p>
<p>The <em>resolution</em> argument governs how long the SIGALARM timeout
waits in seconds. The implementation uses <a class="reference external" href="https://docs.python.org/2/library/signal.html#signal.setitimer" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">signal.setitimer()</span></code></a>
and can be specified as a floating-point value.
The shorter the resolution, the greater the chance of false
positives.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="dagpool.html"
title="previous chapter"><code class="docutils literal"><span class="pre">dagpool</span></code> &#8211; Dependency-Driven Greenthreads</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="db_pool.html"
title="next chapter"><code class="docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/debug.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="dagpool.html" title="dagpool Dependency-Driven Greenthreads"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.21.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42952223-1', 'eventlet.net');
ga('send', 'pageview');
</script>
</body>
</html>