New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev.icinga.com #8139] Add functions for registering file descriptors closed on fork() #1535

Closed
icinga-migration opened this Issue Dec 24, 2014 · 4 comments

Comments

Projects
None yet
1 participant
@icinga-migration
Member

icinga-migration commented Dec 24, 2014

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

Assignee: jrhunt
Status: Resolved (closed on 2015-01-24 14:50:03 +00:00)
Target Version: 1.13
Last Update: 2015-02-15 01:11:30 +00:00 (in Redmine)


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.

Attachments

Changesets

2015-01-24 14:45:59 +00:00 by (unknown) 12ff996

Add registered file descriptors for neb modules

Icinga now supports the concept of a "registered file descriptor",
that should be closed immediately after the process forks.  This is
intended for use by Event Brokers, who may need to allocate file descriptors
for things like pipes or sockets, and need those descriptors to be
closed before active checks or other forked commands are run.

fixes #8139

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>

2015-01-24 14:47:57 +00:00 by (unknown) 99f7339

Update AUTHORS

refs #8139
refs #8140
@icinga-migration

This comment has been minimized.

Member

icinga-migration commented Jan 24, 2015

Updated by mfriedrich on 2015-01-24 14:26:12 +00:00

https://github.com/filefrog/icinga-iris

@icinga-migration

This comment has been minimized.

Member

icinga-migration commented Jan 24, 2015

Updated by mfriedrich on 2015-01-24 14:46:35 +00:00

  • Status changed from New to Assigned
  • Assigned to set to jrhunt
  • Target Version set to 1.13

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.

@icinga-migration

This comment has been minimized.

Member

icinga-migration commented Jan 24, 2015

Updated by Anonymous on 2015-01-24 14:50:03 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 12ff996.

@icinga-migration

This comment has been minimized.

Member

icinga-migration commented Feb 15, 2015

Updated by mfriedrich on 2015-02-15 01:11:30 +00:00

  • Subject changed from Registered File Descriptors Patch to Add functions for registering file descriptors closed on fork()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment