From: Carlo M. A. B. <ca...@sa...> - 2009-01-22 10:55:57
|
On Thu, Jan 22, 2009 at 12:24:56PM +0800, Spike Spiegel wrote: > > right now when gmetad fails an error is logged and in some cases the > connection to the client interrupted returning invalid XML or in other > cases (item not found or broken request) the entire tree is returned. gmetad (before r1946 in trunk) has the following "protocol" to signal errors to the interactive port (or should have since it is obviously misbehaving as coded as shown by the sporadic errors) : 1) if request is not allowed by ACL, report and close socket, otherwise 2) if request can't be read from socket, report and close socket. 3) if request is malformed/missing/invalid, report and assume "/". invalid XML wasn't meant to be returned unless a severe error was triggered and only as a last result because the data was already being sent but the error couldn't be recovered for. > This imho is bad behavior and code should be added to inform the > client of the error. the interactive port was designed to mimic the behaviour from the original gmetad port which always returns the whole tree. > but before that's possible it needs to be agreed > how this communication should happen. if your concern is about returning too much data and the request was missing, it might be better then to return no tree information (which should be also valid) > I'm not really fond of XML or > ganglia's code, but I'd guess adding an ERROR element to the DTD is > possibly a solution. At that point whenever there's an error > root_report_start() should be called at the very least and an error > element added inside. This should also work nicely for the multi-item > per request patch I proposed elsewhere [1] as you'd have an error per > requested element. for the XML to be valid the header, the body and the footer had to be sent so this would again lead to broken XML. Carlo |