On Wed, Sep 26, 2012 at 7:46 PM, Jonathan Vanasco <span dir="ltr">&lt;<a href="mailto:twisted-python@2xlp.com" target="_blank">twisted-python@2xlp.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
while migrating some functionality to a deferred callback chain and debugging my app, i noticed this oddity...<br>
<br>
if a function doesn&#39;t have the proper args/kwargs definition, no error is raised and everything just hangs<br>
<br></blockquote><div>...<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
then the reactor just seems to hang.<br>
<br>
if i kill the process, then the Unhandled Error and Traceback message prints.<br>
If i wait until the next interval that the timerservice runs, then the Unhandled Error and Traceback message will print then ( but that could be minutes/hours later ).<br>
<br>
has anyone else noticed this before ?<br></blockquote><div><br>The reactor isn&#39;t hanging, it&#39;s running just fine. The problem is you expect the Deferred&#39;s error to be logged immediately, which is not guaranteed; the error is only logged if the object is garbage collected, which may take a while, or never happen if you&#39;ve kept extra references around. The latter can happen by accident.<br>
 <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
are there any good ways around this , other than setting the timer service to be within seconds during bugtesting ?<br></blockquote><div><ol><li>Add a logging errback to all Deferreds at the end of the callback chain: d.addErrback(log.err).</li>
<li>Less effective, but also helpful, is making sure you delete all unnecessary references to a Deferred once you&#39;ve fired it, to make sure it gets garbage collected:<br></li></ol><div style="margin-left:40px">   self.d.callback(None)<br>
   del self.d # remove extra reference that prevents garbage collection<br></div><br><a href="http://bit.ly/NS6ptj">http://bit.ly/NS6ptj</a> explains the issue.<br><br></div></div>-- <br>Itamar Turner-Trauring, Future Foundries LLC<br>
<a href="http://futurefoundries.com/" target="_blank">http://futurefoundries.com/</a> — Twisted consulting, training and support.<br><br>