Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #1962] make logging and debug logging threadsafe in idomod #751

Closed
icinga-migration opened this issue Sep 27, 2011 · 2 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/1962

Created by mfriedrich on 2011-09-27 18:27:27 +00:00

Assignee: (none)
Status: Rejected (closed on 2011-10-20 13:57:50 +00:00)
Target Version: (none)
Last Update: 2014-12-08 14:46:23 +00:00 (in Redmine)

Icinga Version: 1.10.0
OS Version: any

this issue follows #1931 where the overflow handling is discussed. this should be dumped to the logs either way. the problem remains - the logging functions are not thread safe.

  • debug log
  • write_to_all_logs

the second function can't be used as it invokes a callback if the data would be written to icinga.log too. so a change to local syslog_r only should be targetted, while adding a mutex lock on the debug log itsself. local facilities and such can be added later on.

Changesets

2011-09-27 18:31:10 +00:00 by mfriedrich 9dfb19f

idoutils: move thread start + origcfg dump to new NEBTYPE_PROCESS_INITSTART and retained back to normal #1934, make logging threadsafe #1962, correct overflow log #1931

this changes the thread not to be started in event loop (new neb type making it happen sooner).
the original config gets dumped immediately, but after daemonizing too, which NEBTYPE_PROCESS_INITSTART
indicates for now. the retained config dump stays where it happened, the target in timeline is perfectly
fine when using a circular buffer to cache these things.
while the consumer queue thread is reading and dumping the configs to the database, the core can start
the event loop, pushing status updates and current checks to the queue as well.

the main disadvantage on a non-blocking neb module will be the buffer holding the data and needing
the exact same time as the core was blocked to finally dump the whole config stuff. so this remains still
in testing mode, and needs possible enhancements, basically on the sleep time of the threads and so on.

the debug logging not being threadsafe was being fixed with the previous commit, holding a file pointer
and writing simultanously to it is not really a good idea. the main logging functions used a core internal
function which would invoke a neb callback to self() if something gets written to the icinga log file.
this has been removed for now, the syslog will be used like done in ido2db, further logging must be done
side by side with the demanded ido2db logging and their syslog facilities.
previously, the newly added warning on the buffer overflow when the retry was hit, resulted in a segfault
therefore this fix was done urgent.

refs #1931
refs #1934
refs #1962

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-10-20 13:57:50 +00:00

  • Status changed from Assigned to Rejected
  • Assigned to deleted mfriedrich
  • Target Version deleted 1.6

dropped threading again.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-12-08 14:46:24 +00:00

  • Project changed from 18 to Core, Classic UI, IDOUtils
  • Category changed from 70 to IDOUtils
  • Icinga Version set to 1
  • OS Version set to any

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant