[icinga-users] fix for servicestatusdata_add - causing "error writing to datasink"

Michael Friedrich michael.friedrich at univie.ac.at
Fri Sep 11 21:39:46 CEST 2009


Hi there,

since the bug has been reported I was was debugging the code and 
finally, I've found my miss.

Current concept of the code breakup was to work with pointers to 
addresses of the variables holding the values and build a type neutral 
array handing over to the rdbm-decide function wherein the values get 
casted back. there the query is prepared as a string.

Since the servicestatusdata_add query has 47 values I coded 2 wrong 
typecasts (integer instead of string) and then causing a segfault to the 
code. And for what it's worth I pasted the Code for MySQL to Postgres 
too. If you do a cat dbqueries.c | wc -l you will see how much code has 
been added comparing to old version 0.8.3 and how easy losing 
concentration will be ;-)

If the ido2db child dies from a segfault(sigsev 11), idomod won't be 
able to write to datasink causing the error message. Next try ido2db 
parent forks a new child and then kept back data gets flushed (that's 
why two ido2db processes show up in ps aux).

Tested the fix ok and everything runs fine now!

It's fixed in GIT master: 
https://git.icinga.org/index?p=icinga-core.git;a=summary

or get this new version or this file: 
https://git.icinga.org/index?p=icinga-core.git;a=blob_plain;f=module/idoutils/src/dbqueries.c;hb=068baf7bfc99a2a5a88b64d06df49d7395008b40

put it into module/idoutils/src/ and move to dbqueries.c overriding the 
old one. I would recommend cloning the actual GIT master like this 
getting all the latest fixes:

git clone git://git.icinga.org/icinga-core.git

Kind regards,
Michael




More information about the icinga-users mailing list