<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 29, 2013 at 10:37 AM, Alec Matusis <span dir="ltr">&lt;<a href="mailto:matusis@yahoo.com" target="_blank">matusis@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Gelin,<br>
<div class="im"><br>
&gt; As I know there are two epoll implementations in twisted, one that from<br>
twisted itself and another one comes from standard library since py 2.6.<br>
<br>
</div>I was slightly incorrect in my email: the combination where it happens<br>
infrequently is actually Twisted 10.2 with python 2.7.3 (not Twisted 10.1 as<br>
I wrote).<br>
How can I check whether twisted is using Python’s epoll or its own in this<br>
combination? And how can I switch between epoll implementations in my app?<br>
<br>
Alec<br>
<br>
From: Gelin Yan [mailto:<a href="mailto:dynamicgl@gmail.com">dynamicgl@gmail.com</a>]<br>
Sent: Tuesday, May 28, 2013 6:42 PM<br>
To: Alec Matusis<br>
<div class=""><div class="h5">Subject: Re: [Twisted-Python] any progress for Ticket #6346, #6378?<br>
<br>
<br>
On Wed, May 29, 2013 at 8:31 AM, Alec Matusis &lt;<a href="mailto:matusis@yahoo.com">matusis@yahoo.com</a>&gt; wrote:<br>
&gt;   By reading these comments, It looks like recent version of twisted<br>
&gt;may<br>
&gt;suffer from this problem. So what version of twisted should  I use? Do<br>
&gt;I<br>
&gt;need to keep using 10.1?<br>
This problem is very frequent on Linux with Python 2.7 / Twisted 12<br>
combination (we had to quickly roll back- cannot operate with that combo).<br>
<br>
It never happened with Python 2.6 / Twisted 10 (as in years).<br>
<br>
It happens very infrequently with Python 2.7 / Twisted 10.1 (as 1x in weeks)<br>
<br>
Right now I have a server in this state on Python 2.7 / Twisted 10.1. It<br>
refuses 30% of new connections, spewing this error:<br>
<br>
2013-05-28 17:28:25-0700 [twisted.internet.protocol.ServerFactory] Unhandled<br>
Error<br>
        Traceback (most recent call last):<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/python/log.py&quot;, line 69, in callWithContext<br>
            return context.call({ILogContext: newCtx}, func, *args, **kw)<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/python/context.py&quot;, line 59, in callWithContext<br>
            return self.currentContext().callWithContext(ctx, func, *args,<br>
**kw)<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/python/context.py&quot;, line 37, in callWithContext<br>
            return func(*args,**kw)<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/internet/epollreactor.py&quot;, line 217, in<br>
_doReadOrWrite<br>
            why = selectable.doRead()<br>
        --- &lt;exception caught here&gt; ---<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/internet/tcp.py&quot;, line 938, in doRead<br>
            transport = self.transport(skt, protocol, addr, self, s,<br>
self.reactor)<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/internet/tcp.py&quot;, line 752, in __init__<br>
            self.startReading()<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/internet/abstract.py&quot;, line 365, in<br>
startReading<br>
            self.reactor.addReader(self)<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/internet/epollreactor.py&quot;, line 100, in<br>
addReader<br>
            self._add(reader, self._reads, self._writes, self._selectables,<br>
_epoll.IN, _epoll.OUT)<br>
          File<br>
&quot;/usr/local/encap/Python-2.7.3/lib/python2.7/site-packages/Twisted-10.2.0-py<br>
2.7-linux-x86_64.egg/twisted/internet/epollreactor.py&quot;, line 88, in _add<br>
            self._poller._control(cmd, fd, flags)<br>
          File &quot;_epoll.pyx&quot;, line 125, in _epoll.epoll._control<br>
<br>
        exceptions.IOError: [Errno 2] No such file or directory<br>
<br>
<br>
If I restart the server, it will be stable for a couple of weeks, until some<br>
event triggers this problem again. We hope that this problem is fixed before<br>
we are really forced to migrate to newer Python, otherwise there&#39;s no real<br>
upgrade path for us using Twisted.<br>
<br>
From: <a href="mailto:twisted-python-bounces@twistedmatrix.com">twisted-python-bounces@twistedmatrix.com</a><br>
[mailto:<a href="mailto:twisted-python-bounces@twistedmatrix.com">twisted-python-bounces@twistedmatrix.com</a>] On Behalf Of Gelin Yan<br>
Sent: Saturday, May 25, 2013 7:51 AM<br>
To: Twisted general discussion<br>
Subject: Re: [Twisted-Python] any progress for Ticket #6346, #6378?<br>
<br>
<br>
<br>
On Sat, May 25, 2013 at 3:22 AM, &lt;<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>&gt; wrote:<br>
On 04:21 pm, <a href="mailto:dynamicgl@gmail.com">dynamicgl@gmail.com</a> wrote:<br>
&gt;Hi All<br>
<br>
Hi Gelin,<br>
<br>
I don&#39;t have anything extra to add about the status of those two tickets<br>
(I think you meant #6373 rather than #6378, by the way) - which is<br>
exactly why I&#39;m replying.<br>
<br>
Twisted development doesn&#39;t take place in secret.  The issue tracker<br>
should always reflect the latest state of the development process.  If<br>
an issue has had no comments and a branch no commits for a couple<br>
months, then it&#39;s almost certainly because no one has worked on the<br>
issue for a couple months.<br>
<br>
So you generally don&#39;t need to ask if there has been any progress,<br>
because progress will always be reflected in ticket history or in<br>
version control.<br>
&gt;    I am quite concerned about these two tickets due to recently I may<br>
&gt;port<br>
&gt;one of my systems to Ubuntu.<br>
Perhaps you can help out with the tickets, then!  As hopefully you&#39;ve<br>
noticed, one of them is currently up for review.  This means a developer<br>
believes a fix for the problem has been created and is just waiting for<br>
someone else to look it over and agree that it should be applied to<br>
trunk.  If this happens, then the fix will be available in the next<br>
release of Twisted, 13.1.0, which will probably happen in just a few<br>
weeks.<br>
<br>
For more details about how the review process works, please take a look<br>
at this wiki page:<br>
<br>
    <a href="http://twistedmatrix.com/trac/wiki/ReviewProcess" target="_blank">http://twistedmatrix.com/trac/wiki/ReviewProcess</a><br>
<br>
Jean-Paul<br>
&gt;   By reading these comments, It looks like recent version of twisted<br>
&gt;may<br>
&gt;suffer from this problem. So what version of twisted should  I use? Do<br>
&gt;I<br>
&gt;need to keep using 10.1?<br>
&gt;<br>
&gt;  I always use the latest version on windows.<br>
&gt;<br>
&gt;Regards<br>
&gt;<br>
&gt;gelin yan<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br>
<br>
Hi exarkun<br>
<br>
    I noticed &quot;review&quot; tag has been removed for a while so does it imply<br>
this ticket is still pending? <br>
<br>
   I am not quite familiar how epoll works on linux so my help probably can<br>
be neglected. I event can&#39;t sure how to reproduce this bug.<br>
<br>
   By the way, Is it possible to use the &quot;old&quot; epoll implementation instead<br>
of the built in epoll from python with the latest version? It looks like<br>
this old one works quite well.  Thanks<br>
<br>
Regards<br>
<br>
gelin yan <br>
<br>
<br>
Hi Alec<br>
<br>
   Thanks for your info. As I know there are two epoll implementations in<br>
twisted, one that from twisted itself and another one comes from standard<br>
library since py 2.6. If I was correct, since 10.2, twisted has been used<br>
the standard epoll if applicable. I am curious which one did you use? Have<br>
you tried py 2.7 &amp; epoll from twisted itself?<br>
<br>
Regards<br>
<br>
gelin yan<br>
<br>
</div></div></blockquote></div><br></div><div class="gmail_extra" style>Hi Alec</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>  there is a link: <a href="http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.0.0/twisted/internet/epollreactor.py">http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.0.0/twisted/internet/epollreactor.py</a></div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>I strip the related part and paste here:</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style><span class="" style="font-weight:bold;color:rgb(0,0,0);font-family:monospace;font-size:12px">try</span><span class="" style="color:rgb(0,0,0);font-family:monospace;font-size:12px">:</span></div>
<div class="gmail_extra" style><span class="" style="color:rgb(0,0,0);font-family:monospace;font-size:12px">  </span><span class="" style="font-weight:normal;color:rgb(0,0,0);font-family:monospace;font-size:12px">from</span><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px"> </span><span class="" style="color:rgb(85,85,85);font-family:monospace;font-size:12px">select</span><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px"> </span><span class="" style="color:rgb(0,0,0);font-family:monospace;font-size:12px">import</span><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px"> epoll</span></div>
<div class="gmail_extra" style><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px">except </span><span style="color:rgb(153,0,0);font-family:monospace;font-size:12px;font-weight:bold">ImportError:</span></div>
<div class="gmail_extra" style><span style="color:rgb(153,0,0);font-family:monospace;font-size:12px;font-weight:bold">  from twisted.python import _epoll</span></div><div class="gmail_extra" style><span style="color:rgb(153,0,0);font-family:monospace;font-size:12px;font-weight:bold"><br>
</span></div><div class="gmail_extra" style><font face="courier new, monospace">in the latest trunk  there is only  from select import epoll.</font></div><div class="gmail_extra" style><font face="courier new, monospace"><br>
</font></div><div class="gmail_extra" style><font face="courier new, monospace">I am not sure which one you are using. epoll has been available in standard library since Py 2.6. Twisted has been used its own epoll wrapper for years until recently.</font></div>
<div class="gmail_extra" style><font face="courier new, monospace"><br></font></div><div class="gmail_extra" style><font face="courier new, monospace">Regards</font></div><div class="gmail_extra" style><font face="courier new, monospace"><br>
</font></div><div class="gmail_extra" style><font face="courier new, monospace">gelin yan</font></div></div>