Skip to content
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

when forking: close FDs in optimized way #934

Open
wants to merge 46 commits into
base: master
Choose a base branch
from

Conversation

mighq
Copy link

@mighq mighq commented Feb 9, 2015

  • exec plugind & collectdmon patched
  • code ported from sudo utility

Problem was occurring when fs.file-max sysctl option was set to really high number (millions). In combination with fork-every-time exec data sources, it was spending too much time in CPU doing millions of unneccessary close() calls.

ChangeLog: exec plugin: optimized way (faster) of closing the file descriptors

* code ported from sudo utility
@mfournier mfournier added the Bug A genuine bug label Feb 24, 2015
@peterbowey
Copy link

Patch 3f847de has an error within this section (based @ current collectd master release):

diff --git a/src/Makefile.am b/src/Makefile.am
index a9d8582..029a898 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,7 @@ bin_PROGRAMS = collectd-nagios collectdctl collectd-tg

 collectd_SOURCES = collectd.c collectd.h \
           common.c common.h \
+          compat/closefrom.c \
           configfile.c configfile.h \
           filter_chain.c filter_chain.h \
           meta_data.c meta_data.h \
@@ -87,7 +88,7 @@ else
 collectd_LDADD += -loconfig
 endif

-collectdmon_SOURCES = collectdmon.c
+collectdmon_SOURCES = collectdmon.c compat/closefrom.c
 collectdmon_CPPFLAGS = $(AM_CPPFLAGS)

 collectd_nagios_SOURCES = collectd-nagios.c

The patch section -22,6 +22,7 (for Makefile.am) needs removing.
The new resulting '/src/Makefile.am' patch would be:

diff --git a/src/Makefile.am b/src/Makefile.am
index a9d8582..029a898 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,7 +88,7 @@ 
 sbin_PROGRAMS = collectdmon
 bin_PROGRAMS = collectd-nagios collectdctl collectd-tg

-collectdmon_SOURCES = collectdmon.c
+collectdmon_SOURCES = collectdmon.c compat/closefrom.c
 collectdmon_CPPFLAGS = $(AM_CPPFLAGS)

 collectd_nagios_SOURCES = collectd-nagios.c

Modified (local) Pull #934 Tested OK @ current collectd master.

octo and others added 22 commits June 13, 2019 11:33
* nvidia_gpu
* write_stackdriver
* pcie_errors

The first 2 are disabled, as I don't know what lib they require
(configure fails)

Change-Id: I56456b418edd3defb3c5620a5ad58f527951309c
(cherry picked from commit 09abfaa)
Change-Id: I8199655fcd22082a2f3cfb0e5ab7db289df1a5e7
(cherry picked from commit 9e5b363)
Change-Id: I655dd0b3cb82053f7cc50dec149d4f7cc25ee18b
(cherry picked from commit 2d485cf)
If a user set

  MetaData "foo" "bar"

and a metric does not have meta data (vl->meta == NULL), it causes
unexpected match.

Existance of MetaData config should be checked before meta data in
a metric.

See also: collectd#1930

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
(cherry picked from commit d4f5388)
3b9c7b2 introduced stricter RC check.
This commit provides user feedback when config callback is failing.

Change-Id: Ia9c13048e95559b5be84477fc1602ff418a1df37
(cherry picked from commit 42a30ef)
…mismatches on Solaris

(cherry picked from commit 54d4f88)
Some plugins' RC was != 0 and started to fail due to
stricter verification introduced by 3b9c7b2.
This commit fixes those return values.
For some plugins, fix verbosity of error message: non-zero rc
should be error, not warning.

Change-Id: I9a3f1f80e266858b6744fd9d9d99b352b8d94306

Change-Id: Ibf6ebc6cdc93c6e105d488e4a131dcb6e8eea19b

Change-Id: I35bac15fa0a89b068575739ac1cff0115c9d3a40

s

Change-Id: I992002c56763fbdea5347e5b6e176cc86f5a08ce
(cherry picked from commit a07f44c)
Change-Id: Iae7c3208024372485fd0901898cbe2e178610082
(cherry picked from commit d75591c)
(cherry picked from commit 4af2afc)
Change-Id: I0972f74f3fff05cf29fa9b0be383f0b0df1e6d03
Fixes: collectd#3200
(cherry picked from commit 835a58c)
glibc has removed __NAMESER and __BIND symbols from their codebase.

There is no benefits of use defines from glibc, so replaced them by numbers.

Closes: collectd#3145
(cherry picked from commit faa20ef)
limits.h check removed in 865f2eb
limits.h included in src/daemon/collectd.h unconditionally

Issue: collectd#3181
(cherry picked from commit d994169)
(cherry picked from commit abaa1c8)
zebity and others added 19 commits July 19, 2019 12:42
related to backports/cherry-picks.
(cherry picked from commit 262212d)
Automatically merged due to "Automerge" label
(cherry picked from commit 47f8966a2ea076a918d0d1383765621651337881)
Change-Id: Idab2c4ffa242a73b651f1b056f85f905e356c5ac
* not really useful, rather confusing
* talking about changes from commit 3f847de
@mighq
Copy link
Author

mighq commented Aug 10, 2019

manually "rebased" the patch on top of 5.9 sources and then merged current master

Michal Zubac added 4 commits August 10, 2019 15:39
* src/compat/closefrom.c
* src/compat/missing.h
* only supporting Linux - as oposed to original BSD and HP-UX variants of closefrom
* dropping the original copy+paste structure and using utils_* style
* by adding new header files to the _SOURCES lists in Makefile.am
@octo octo added Fix A pull request fixing a bug and removed Bug A genuine bug labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix A pull request fixing a bug Pending contributor action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants