~ubuntu-branches/debian/sid/pyro/sid

« back to all changes in this revision

Viewing changes to docs/10-errors.html

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Goretkin
  • Date: 2011-08-21 16:04:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20110821160400-ugc9tghmf0ycxzwp
Tags: 1:3.14-1
* New upstream release
    - /usr/bin/pyro-rns was removed by upstream
* SECURITY UPDATE: arbitrary file overwriting via symlink (Closes: #631912,
  LP: #830742)
    - store pidfile in /var/run instead of /tmp
    - Pyro/ext/daemonizer.py changed default location to /var/run
    - Pyro/ext/daemonizer.py added command-line parameter (--pidfile=...) to
      override default pidfile location
    - default location for pidfile is tunable via /etc/default/pyro-nsd
    - CVE-2011-2765 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
2
<html>
3
 
<!-- $Id: 10-errors.html,v 2.30.2.5 2009/03/28 11:52:19 irmen Exp $ -->
4
3
<head>
 
4
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
5
5
  <title>PYRO - Errors and Troubleshooting</title>
6
6
  <link rel="stylesheet" type="text/css" href="pyromanual_print.css" media="print">
7
7
  <link rel="stylesheet" type="text/css" href="pyromanual.css" media="screen">
29
29
  <p>The <a href="#specificissues">Specific issues</a> section at the end contains more detailed discussion of specific issues you may encounter:
30
30
        <ul>
31
31
                <li>127.0.0.1 connection problems</li>
 
32
                <li>problems when using user defined exception classes</li>
32
33
        </ul>
33
 
        </p>
34
34
 
35
35
  <h3><a name="errors" id="errors"></a>Pyro Errors</h3>
36
36
 
302
302
  is returned).
303
303
 
304
304
  <h3><a name="shoot" id="shoot"></a>Troubleshooting</h3>
305
 
  <p><strong>Online Pyro troubleshooting wiki:</strong> I've put up
306
 
  some wiki (interactive) pages about Pyro. One of them is this one: <a href=
307
 
  "http://www.razorvine.net/python/PyroTroubleshooting">Pyro Troubleshooting</a>. Have a look there if you can't find
308
 
  an answer below. (The other pages can be found by going to <a href="http://www.razorvine.net/python/FrontPage">the
309
 
front page</a>).</p>
310
 
<p><strong>Using IronPython or Jython?</strong> Each of these has its own possible issues (when compared to standard CPython).
311
 
        If you are using one of these instead of standard CPython, you may experience problems or unexpected behaviour that
312
 
        are not mentioned elsewhere in this chapter or manual.
313
 
        Because both of them are a bit of a moving target, specific issues related to them are 
314
 
        discussed on the wiki pages: 
315
 
        <a href="http://www.razorvine.net/python/PyroAndJython">Jython</a> ;
316
 
        <a href="http://www.razorvine.net/python/PyroAndIronPython">IronPython</a> .
317
 
        </p>
318
305
 
319
306
  <p>Use <code>python -m Pyro.configuration</code> to get a printout of Pyro's active configuration settings.</p>
320
307
        
548
535
 
549
536
      <td>Most likely a bug.</td>
550
537
 
551
 
      <td>Contact <a href="mailto:irmen@users.sourceforge.net">me</a>.</td>
 
538
      <td>Contact <a href="mailto:irmen@razorvine.net">me</a>.</td>
552
539
    </tr>
553
540
  </table>
554
541
  
595
582
        <li>Fix your DNS server to return the correct IP address for your host if it returns 127.0.0.1</li>
596
583
        <li>Use the appropriate command line options for the Name Server or Event Server script tools to bind it to a different hostname.</li>
597
584
</ul>      
598
 
  </p>
 
585
 
 
586
  <h4>Problems with user defined exception classes</h4>
 
587
  <p>In Python 2.5 and later, there is an issue with user-defined exceptions. Say you have a custom exception class written as follows:</p>
 
588
  <pre>class MyEx(Exception):
 
589
    def __init__(self, mymessage):
 
590
        self.mymessage=mymessage
 
591
    def __str__(self):
 
592
        return "[MyEx '%s']" % self.mymessage
 
593
</pre>
 
594
<p>If you are passing these exceptions over the wire in Pyro method calls, you will find that your program crashes with an error like this:</p>
 
595
<pre>TypeError: ('__init__() takes exactly 2 arguments (1 given)', &lt;class '__main__.MyEx'&gt;, ())</pre>
 
596
<p>
 
597
This is not Pyro's fault: it is caused by a change in the Exception classes which was introduced in Python 2.5. 
 
598
This change seems to cause that Exception objects don't follow the usual pickle protocol.
 
599
The unpickling of the exception object fails, because the <code>__init__</code> method is called without any arguments
 
600
(it shouldn't even be called at all by the way!).
 
601
Unfortunately, you won't be able to fix this problem by writing a <code>__getinitargs__</code> or <code>__getnewargs__</code> method to force the correct parameters, because these methods won't be called.
 
602
The easiest way to work around this problem now seems to change the init method so that it uses <code>*args</code> instead of a single argument (this is what the built in Exceptions seem to do), or change it a little so that it also works with zero arguments:
 
603
</p>
 
604
<pre>    def __init__(self, mymessage=None):
 
605
        self.mymessage=mymessage
 
606
</pre>
 
607
<p>
 
608
If you don't need any special behavior of your own exception objects, it is probably best to just subclass them from Exception and not define any custom methods or properties. That avoids the problem as well. All builtin exceptions should accept a string argument to be used as the exception message, so there is no need to subclass the exception and add custom behavior as shown above, if you just want to remember a message string.
 
609
</p>
599
610
  
600
611
  
601
612
  <div class="nav">