Bug #30748 agent sends invalid XML due to mysqld error message
Submitted: 31 Aug 2007 15:38 Modified: 7 Sep 2007 14:15
Reporter: Sloan Childers Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Agent Severity:S2 (Serious)
Version: OS:Any
Assigned to: Jan Kneschke CPU Architecture:Any

[31 Aug 2007 15:38] Sloan Childers
Description:
We have an issue at GoDaddy where the agent read the last replication error and it contained illegal XML characters.  It was sent to the server as a data collection and because we couldn't parse the XML we told the agent to shut down - assuming an unsupported agent version.

How to repeat:
To reproduce exactly we need a corrupt error message from mysqld for the last replication error.

Suggested fix:
We have two choices.

1) try to parse the xml at the server, if it fails try to replace the bad characters with good characters and attempt to reparse
pro:  if it works the agent doesn't shutdown
con:  if the parsing of the xml still fails after manipulating the data the agent shuts down

2) scan data sections at the agent and make sure we don't send bad xml to the server
pro:  agent and server stay healthy
con:  ????

I see that we already do some data manipulation at the agent to ensure we don't send some invalid XML characters. 

Valid XML 1.0 characters include the following:

0x09, 0x0A, 0x0D,  [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
[31 Aug 2007 17:38] Sloan Childers
<datum>
<target>
<namespace>mysql</namespace>
<classname>server</classname>
<instance>local</instance>
<attribute>Last_Error</attribute>
</target>
<utc></utc>
<value>Error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' on query. Default database: 'EmailAuth'. Query: 'UPDATE UserInfo SET accountStatu'</value><</datum>
[31 Aug 2007 20:00] Jan Kneschke
patch committed to trunk/ in [7405].

encode non-xml UTF8 chars as base64
[5 Sep 2007 14:06] Jan Kneschke
got merged into 1.2. in [7406] by sloan
[6 Sep 2007 21:04] Bill Weber
Using a custom rule and custom data collection, verified the agent doesn't crash, and the email and SNMP traps are ok with build 1.2.0.7481.
[7 Sep 2007 14:15] Peter Lavin
Added to the changelog for version 1.2.