Bug 880535 - Error inserting events when the message contains null bytes
Summary: Error inserting events when the message contains null bytes
Keywords:
Status: NEW
Alias: None
Product: RHQ Project
Classification: Other
Component: Database
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-27 09:21 UTC by vlad crc
Modified: 2022-03-31 04:27 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description vlad crc 2012-11-27 09:21:51 UTC
Description of problem:

We monitor a JBoss and we activated Log Event Sources. In Jboss there is an application which put some errors in log. RHQ tries to insert these errors in the events table but it fails because "invalid byte sequence for encoding "UTF8": 0x00".
This is a known problem with Postgres, strings containing null characters cannot be inserted in "text" fields because Postgres is written in C where null character is used as string terminator.
The solution would be to process these strings in RHQ by removing null characters.

Version-Release number of selected component (if applicable):
4.4

How reproducible:
always
  
Actual results:
2012-11-27 10:03:25,779 WARN  [org.rhq.enterprise.server.event.EventManagerBean] addEventData: Insert of events failed : Batch entry 1 INSERT INTO RHQ_Event (id, event_source_id, timestamp, severity, detail) VALUES ((SELECT nextval('RHQ_EVENT_id_seq'::text)), (SELECT id FROM RHQ_Event_Source WHERE event_def_id = (SELECT id FROM RHQ_Event_Def WHERE name = 'logEntry' AND resource_type_id = (SELECT id FROM RHQ_Resource_Type WHERE name = 'JBossAS Server' AND plugin = 'JBossAS')) AND resource_id = '10433' AND location = '/home/jboss/projects/jboss-server/2/server/dorun/log/server.log'), '1354006941407', 'ERROR', '###error message not shown###') was aborted.  Call getNextException to see the cause.
2012-11-27 10:03:25,779 WARN  [org.rhq.enterprise.server.event.EventManagerBean]      : ERROR: invalid byte sequence for encoding "UTF8": 0x00

Expected results:
Events with null bytes in message description should be successfully inserted.

Comment 1 Heiko W. Rupp 2013-06-27 19:33:45 UTC
Would you be able to create a patch?

Comment 2 vlad crc 2013-07-16 14:43:08 UTC
I will try, depends on my workload.

I am thinking, though, if this will become useless when the events will go to Cassandra.


Note You need to log in before you can comment on or make changes to this bug.