Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
[dev.icinga.com #8139] Add functions for registering file descriptors closed on fork() #1535
This issue has been migrated from Redmine: https://dev.icinga.com/issues/8139
Created by jrhunt on 2014-12-24 21:31:42 +00:00
I have attached a patch that provides a new set of functions for registering file descriptors to be closed on fork().
First, a little history:
My team and I have developed a custom event broker module that understands NSCA wire protocol. After a few months in production, we noticed that our event broker would sometimes be unable to re-bind its TCP port after an Icinga restart. (Incidentally, I believe this may be the same behavior that is causing bug #5879). Upon further investigation, we determined that we had active checks taking upwards of 30s to run (failed SSH checks), and that each check would inherit the bound port from its parent, the main Icinga process.
Since there is no O_CLOEXEC analog for fork(), we opted to build a system whereby event brokers could register file descriptors in a central list, and the main Icinga thread would be diligent about closing those descriptors after every call to fork().
This is that patch.
2015-01-24 14:45:59 +00:00 by (unknown) 12ff996
2015-01-24 14:47:57 +00:00 by (unknown) 99f7339
Updated by mfriedrich on 2015-01-24 14:46:35 +00:00
Looking at the code NEB modules must explicitely register file descriptors by calling register_fd() to actually enable that option. I doubt that it causes harm, nor anyone else will use them in the way you're using them. Since I consider 1.x stable and "complete", it doesn't hurt to add that one, helping your project.
The patch itself should be sent as git format next time, please.