<p>For logging could we look at implementing posix aio on platforms that support it?  I would be willing to help code that.</p>
<p>Justin</p>
<div class="gmail_quote">On Jul 12, 2012 8:51 AM,  &lt;<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 11:32 am, <a href="mailto:itamar@itamarst.org">itamar@itamarst.org</a> wrote:<br>
&gt;On 07/12/2012 05:17 AM, Tristan Seligmann wrote:<br>
&gt;&gt;3) log observers should expect to be inovked in non-reactor threads,<br>
&gt;&gt;making this a Mantissa bug.<br>
&gt;In theory this is the case - the logging howto says &quot;The observer needs<br>
&gt;to be thread safe if you anticipate using threads in your program.&quot; The<br>
&gt;API docs don&#39;t mention threads, though..<br>
&gt;<br>
&gt;In practice however, probably every custom observer gets this wrong, so<br>
&gt;we really need some infrastructure to make this easier or to fix it.<br>
&gt;Possibly we should have some way to indicate an observer is thread-<br>
&gt;safe,<br>
&gt;assume by default they are not, and if they are not wrap them in a<br>
&gt;reactor.callFromThread wrapper.<br>
<br>
The logging system is already a bottleneck in some applications.  Doing<br>
even more work to try to make it properly thread-safe will probably slow<br>
it down even more.<br>
<br>
I think it was a mistake to try to make it possible to use<br>
twisted.python.log free-threaded.  I think we should think about getting<br>
rid of this claimed feature.  Perhaps it could be replaced with a more<br>
explicit, probably more restricted, logging feature for non-reactor<br>
threads.<br>
<br>
Unless someone can magically fix the threading issues without hurting<br>
performance.  Then, great, go for it.<br>
&gt;I would also like some infrastructure to make the file log observer run<br>
&gt;in its own thread, but that&#39;s almost the opposite use case :)<br>
<br>
Sure, but that&#39;s probably based on top of an asynchronous file I/O API<br>
that&#39;s not explicitly thread-based (but probably is thread-based in<br>
practice, because what other kind of asynchronous file I/O even exists).<br>
<br>
Also, to explicitly answer Tristan&#39;s question:<br>
<br>
    It&#39;s a bug in the Mantissa log observer.<br>
<br>
Jean-Paul<br>
<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>
</blockquote></div>