On Mon, 2008-04-21 at 09:37 -0600, Matt Ryan wrote:
> On Mon, 2008-04-21 at 01:45 -0500, Carlo Marcelo Arenas Belon wrote:
> > On Sat, Apr 19, 2008 at 06:10:28AM -0700, Gilad Raphaelli wrote:
> > > 
> > > I was only able to get things started after moving from python2.3 to 
> > > python2.5 (after making the changes above) due to some changes (?) to the 
> > > logging module.  I'm fine with that but believe there were changes done 
> > > to gmond to support older python versions so I'm curious as to what 
> > > direction were you were given in that regard.
> > 
> > using "successfully" python 2.4 here unless the gmond used as a cluster
> > collector is down generating the following unhandled exception which will 
> > take
> > down the listener thread :
> > 
> > error: uncaptured python exception, closing channel <__main__.XmlSocket
> > listening :8651 at -0x48565c74> (exceptions.AttributeError:'NoneType' object
> > has no attribute 'id' [/usr/lib/python2.4/asyncore.py|read|69]
> > [/usr/lib/python2.4/asyncore.py|handle_read_event|385]
> > [./gmetad.py|handle_accept|35]
> > [./gmetad_xmlWriter.py|getXml|108]
> > [./gmetad_xmlWriter.py|_getXmlImpl|72]) 
> > 
> > Carlo
> 
> 
> I'll take a look into this.  Nice catch.


Attached is a patch for this bug.  The problem was that with no data
sources providing data to gmetad (since the gmond used as a cluster
collector is down) the internal data structure was empty, and the code
was trying to navigate an empty data structure, hence the 'NoneType'
exception.
The patch checks for that and does not try to navigate the data
structure if the root node is None.  This results in an empty XML
document - the DTD is printed but no other information.  Is that
behavior correct?  If not, let me know what the correct behavior should
be on the XML port if there is no data being collected, and I will
revise.



> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Ganglia-developers mailing list
> Ganglia-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ganglia-developers

--- gmetad_xmlWriter.py.orig    2008-04-21 11:41:44.000000000 -0600
+++ gmetad_xmlWriter.py 2008-04-21 11:43:15.000000000 -0600
@@ -105,4 +105,7 @@
             filterList = None
         else:
             filterList = filter.split('/')
-        return '%s\n%s\n%s' % (self._xml_starttag, self._xml_dtd, 
self._getXmlImpl(DataStore().rootElement, filterList))
+        rbuf = '%s\n%s\n' % (self._xml_starttag, self._xml_dtd)
+        if DataStore().rootElement is not None:
+            rbuf += self._getXmlImpl(DataStore().rootElement, filterList)
+        return rbuf
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to