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

CPU plugin fails to load on Mac OS X #22

Closed
octo opened this issue Feb 21, 2012 · 35 comments
Closed

CPU plugin fails to load on Mac OS X #22

octo opened this issue Feb 21, 2012 · 35 comments
Assignees
Labels
Bug
Milestone

Comments

@octo
Copy link
Member

@octo octo commented Feb 21, 2012

From: yozshura (Mantis #32)
OS: Mac OS X Snow Leopard (10.6.7)

Here is excerpt from log file:

[2011-05-20 03:16:13] cpu plugin: host_processors returned 4
[2011-05-20 03:16:13] Initialization of plugin `cpu' failed with status -1. Plugin will be unloaded.
[2011-05-20 03:16:13] Initialization complete, entering read-loop.
[2011-05-20 03:16:13] rrdtool plugin: Adjusting "RandomTimeout" to 0.000 seconds.
[2011-05-20 03:20:01] Exiting normally.

System: Macbook Pro 2011, Snow Leopard 10.6.7 64bit

octo added a commit that referenced this issue Feb 25, 2012
php-collection: Fixed DS definitions for apache_bytes, apache_requests and apache_scoreboard merge
@octo
Copy link
Member Author

@octo octo commented Sep 11, 2012

Looks like an invalid argument to host_processors:

#define KERN_INVALID_ARGUMENT       4
        /* The function requested was not applicable to this
         * type of argument, or an argument is invalid
         */
@octo
Copy link
Member Author

@octo octo commented Sep 11, 2012

From http://www.linuxselfhelp.com/gnu/machinfo/html_chapter/mach_9.html:
"This function returns KERN_SUCCESS if the call succeeded, KERN_INVALID_ARGUMENT if host_priv is not a privileged host port, and KERN_INVALID_ADDRESS if processor_count points to inaccessible memory."

@ChrisLundquist
Copy link
Contributor

@ChrisLundquist ChrisLundquist commented Oct 31, 2012

I can reproduce this as well details can be found #72 (comment)

@ChrisLundquist
Copy link
Contributor

@ChrisLundquist ChrisLundquist commented Jan 10, 2013

@octo We should be able to close this issue as #72 is closed. One step closer to 4.10 :)

@octo
Copy link
Member Author

@octo octo commented Jan 30, 2013

Hi Chris,

how are the two issues related? Is this fixed and working now?

Best regards,
—octo

@ChrisLundquist
Copy link
Contributor

@ChrisLundquist ChrisLundquist commented Jan 30, 2013

I am confused as well. I must have been mistaken. I think I just wanted to confirm the issue and then later made the mistake of thinking it was resolved / related. This indeed does appear to be a different issue, my apologies.

@octo octo closed this Apr 5, 2013
@dpzmick
Copy link

@dpzmick dpzmick commented Jul 13, 2013

This issue does not seem to be closed. I am getting the same error with a git clone I just made.

OS X 10.8

@dpzmick
Copy link

@dpzmick dpzmick commented Jul 13, 2013

Nevermind. I noticed some permissions errors showing up in logs. Needed to run as root!

@schmurfy
Copy link

@schmurfy schmurfy commented Jul 15, 2013

still not working for me with 5.3 on OSX 10.8:

$ sudo collectd -f
,[2013-07-15 09:54:50] cpu plugin: Found 4 processors.
[2013-07-15 09:54:50] cpu plugin: processor_info failed: (os/kern) failure
[2013-07-15 09:54:50] cpu plugin: processor_info failed: (os/kern) failure
[2013-07-15 09:54:50] Initialization complete, entering read-loop.


[2013-07-15 09:54:58] cpu plugin: processor_info failed: (os/kern) failure
[2013-07-15 09:55:08] cpu plugin: processor_info failed: (os/kern) failure
[2013-07-15 09:55:28] cpu plugin: processor_info failed: (os/kern) failure
[2013-07-15 09:56:18] cpu plugin: processor_info failed: (os/kern) failure

This problem has been there since I started using collectd, cpu just never worked on my dev machine ;)
I can provide more infos if I know what to look for.

@schmurfy
Copy link

@schmurfy schmurfy commented Jul 15, 2013

After doing some more tests the failure logged do not appear to cause any problem, the cpu stats are reported despite the error.

@dpzmick
Copy link

@dpzmick dpzmick commented Jul 18, 2013

Same thing happens here. Plugin works, but claims to not be working. Here are log messages:

Jul 17 23:53:04 misao collectd[33503]: cpu plugin: processor_info failed: (os/kern) failure
Jul 17 23:53:04 misao kernel[0]: cpu_info(268435458,5,0xffffff801e76248c,0xffffff801e762488) not implemented

@lorenzfischer
Copy link

@lorenzfischer lorenzfischer commented Apr 2, 2014

@dpzmick: do you remember which permissions the plugin complained about? I cannot run as root and I also don't have access to syslog :-(

@dpzmick
Copy link

@dpzmick dpzmick commented Apr 2, 2014

@lorenzfischer I don't sorry. That machine is long gone now :/

@dch
Copy link

@dch dch commented Jun 5, 2014

OK I can repro this atm, on a macbook pro 15" running Mavericks. I've got a debug enabled build and can provide whatever is needed here, incl access if thats useful.

@dch dch reopened this Jun 5, 2014
@dch
Copy link

@dch dch commented Jun 5, 2014

Created new plugin context.
[2014-06-05 19:34:45] [info] cpu plugin: Found 8 processors.
[2014-06-05 19:34:45] [error] cpu plugin: processor_info failed: (os/kern) failure
[2014-06-05 19:34:45] [error] cpu plugin: processor_info failed: (os/kern) failure
[2014-06-05 19:34:45] [debug] plugin_dispatch_values: time = 1401989685.821; interval = 5.000; host = akai.skunkwerks.at; plugin = cpu; plugin_instance = 0; type = cpu; type_instance = user;
[2014-06-05 19:34:45] [debug] plugin_dispatch_values: time = 1401989685.821; interval = 5.000; host = akai.skunkwerks.at; plugin = cpu; plugin_instance = 0; type = cpu; type_instance = nice;
[2014-06-05 19:34:45] [debug] plugin_dispatch_values: time = 1401989685.821; interval = 5.000; host = akai.skunkwerks.at; plugin = cpu; plugin_instance = 0; type = cpu; type_instance = system;
[2014-06-05 19:34:45] [debug] plugin_dispatch_values: time = 1401989685.822; interval = 5.000; host = akai.skunkwerks.at; plugin = cpu; plugin_instance = 0; type = cpu; type_instance = idle;
[2014-06-05 19:34:45] [debug] plugin_dispatch_values: time = 1401989685.822; interval = 5.000; host = akai.skunkwerks.at; plugin = cpu; plugin_instance = 1; type = cpu; type_instance = user;
[2014-06-05 19:34:45] [debug] uc_insert: Added akai.skunkwerks.at/cpu-0/cpu-user to the cache.
[2014-06-05 19:34:45] [error] cpu plugin: processor_info failed: (os/kern) failure
[2014-06-05 19:34:45] [debug] uc_insert: Added akai.skunkwerks.at/cpu-0/cpu-nice to the cache.
[2014-06-05 19:34:45] [debug] uc_insert: Added akai.skunkwerks.at/cpu-0/cpu-system to the cache.
[2014-06-05 19:34:45] [debug] uc_insert: Added akai.skunkwerks.at/cpu-0/cpu-idle to the cache.
[2014-06-05 19:34:45] [debug] uc_insert: Added akai.skunkwerks.at/cpu-1/cpu-user to the cache.
[2014-06-05 19:34:45] [debug] write_riemann plugin: Successfully created protobuf for metric: host = "akai.skunkwerks.at", service = "cpu-0/cpu-user"
[2014-06-05 19:34:45] [debug] write_riemann plugin: Successfully created protobuf for metric: host = "akai.skunkwerks.at", service = "cpu-0/cpu-nice"
[2014-06-05 19:34:45] [debug] write_riemann plugin: Successfully created protobuf for metric: host = "akai.skunkwerks.at", service = "cpu-0/cpu-system"
[2014-06-05 19:34:45] [debug] write_riemann plugin: Successfully created protobuf for metric: host = "akai.skunkwerks.at", service = "cpu-0/cpu-idle"
[2014-06-05 19:34:45] [debug] write_riemann plugin: Successfully created protobuf for metric: host = "akai.skunkwerks.at", service = "cpu-1/cpu-user"
[2014-06-05 19:34:45] [debug] name = collectd; num_proc = 2; num_lwp = 17; vmem_size = 5106257920; vmem_rss = 6897664; vmem_data = 0; vmem_code = 0; vmem_minflt_counter = 280; vmem_majflt_counter = 17700; cpu_user_counter = 4817609760; cpu_system_counter = 8825174929; io_rchar = -1; io_wchar = -1; io_syscr = -1; io_syscw = -1;
[2014-06-05 19:34:45] [debug] name = beam; num_proc = 1; num_lwp = 35; vmem_size = 2840875008; vmem_rss = 82137088; vmem_data = 0; vmem_code = 0; vmem_minflt_counter = 502; vmem_majflt_counter = 28684; cpu_user_counter = 51953853006; cpu_system_counter = 6779186057; io_rchar = -1; io_wchar = -1; io_syscr = -1; io_syscw = -1;
[2014-06-05 19:34:45] [debug] name = java; num_proc = 0; num_lwp = 0; vmem_size = 0; vmem_rss = 0; vmem_data = 0; vmem_code = 0; vmem_minflt_counter = 0; vmem_majflt_counter = 0; cpu_user_counter = 0; cpu_system_counter = 0; io_rchar = -1; io_wchar = -1; io_syscr = -1; io_syscw = -1;
@ojilles
Copy link

@ojilles ojilles commented Sep 16, 2014

Still here, indeed. (Fails on all my Macs)

@octo
Copy link
Member Author

@octo octo commented Sep 17, 2014

[2014-06-05 19:34:45] [error] cpu plugin: processor_info failed: (os/kern) failure

This error appears to be returned when querying the PROCESSOR_TEMPERATURE property. This at least explains why the plugin "appears to be working": Reading the cpu performance works, but reading the temperature fails.

@ChrisLundquist
Copy link
Contributor

@ChrisLundquist ChrisLundquist commented Sep 17, 2014

Prior Art for reading CPU temps on OS X

@octo
Copy link
Member Author

@octo octo commented Sep 17, 2014

Thanks Chris! It actually very much looks like the temperature is (attempted to be) read, but after that the variable holding the temperature is never touched again, making this an entirely pointless endeavor.

Since this doesn't appear to break backwards compatibility, I'll likely just remove the code from the cpu plugin entirely and look into adding it to the apple_sensors plugin instead.

@ChrisLundquist
Copy link
Contributor

@ChrisLundquist ChrisLundquist commented Sep 17, 2014

👍 That would simplify the cross platform concerns, and make for less code to maintain.

octo added a commit that referenced this issue Sep 17, 2014
This code would throw an error for some systems, because the temperature
couldn't be read. Since the plugin still works in general, this was very
confusing to users. Becaus the temperature, even when read sucessfully, was
never dispatched, remove the code entirely. We might want to add this back to
the apple_sensors plugin eventually.

Fixes: #22
@octo octo modified the milestones: 5.3, 4.10 Sep 17, 2014
@octo octo self-assigned this Sep 17, 2014
@octo octo closed this Sep 17, 2014
@ojilles
Copy link

@ojilles ojilles commented Sep 17, 2014

Thanks for very swift action!

@ifesdjeen
Copy link
Contributor

@ifesdjeen ifesdjeen commented Dec 1, 2014

Still fails on master...

cpu plugin: host_processors returned 4
Initialization of plugin `cpu' failed with status -1. Plugin will be unloaded.
pkit pushed a commit to pkit/collectd that referenced this issue Dec 18, 2014
Fix leaking json generator handle on shutdown
@HakShak
Copy link

@HakShak HakShak commented Dec 21, 2014

Yeah, same here with 5.4 using homebrew on OSX 10.10.1

I get the log error and I also don't get any data for the CPU in graphite (everything else is working fine). There really isn't anywhere f710030 could have been reverted...

@ilyaevseev
Copy link

@ilyaevseev ilyaevseev commented Mar 3, 2015

The problem still actual.
Mac OS X 10.8.5, Collectd 5.4.1 from Homebrew:

[error] cpu plugin: processor_info failed: (os/kern) failure

@mfournier
Copy link
Contributor

@mfournier mfournier commented Mar 5, 2015

On Tue, Mar 03, 2015 at 12:41:11PM -0800, Ilya Evseev wrote:

The problem still actual.
Mac OS X 10.8.5, Collectd 5.4.1 from Homebrew:

Yes, 5.4.1 is know to have this problem. Give 5.4.2 a try please, and let
us know if you encounter any problem.

@philhq
Copy link

@philhq philhq commented Mar 11, 2015

I'm running 5.4.2 and I have the same error.

@mfournier
Copy link
Contributor

@mfournier mfournier commented Mar 12, 2015

OK, so it seems there is another issue resulting in the same error message. Can somebody build collectd with --enable-debug and post a gdb backtrace of the crash ? Thanks!

@mfournier mfournier reopened this Mar 12, 2015
@theoriginalgri
Copy link

@theoriginalgri theoriginalgri commented May 8, 2015

I built 5.4.2 with --enable-debug. Even though I don't see any [debug] messages.

My log (cleared prior to start):

08.05.15 20:43:23,824 collectd[75864]: cpu plugin: host_processors returned 4
08.05.15 20:43:23,824 collectd[75864]: Initialization of plugin `cpu' failed with status -1. Plugin will be unloaded.

Executing plugin test (-f -T):

Created new plugin context.
[New Thread 0x1047 of process 75864]
[New Thread 0x1203 of process 75864]
[New Thread 0x1303 of process 75864]
[New Thread 0x1403 of process 75864]
[New Thread 0x1503 of process 75864]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x1047 of process 75864]
0x000000010000ab08 in plugin_write (plugin=<optimized out>, ds=<optimized out>, vl=0x100200090) at plugin.c:1650
1650          status = (*callback) (ds, vl, &cf->cf_udata);
(gdb) bt
#0  0x000000010000ab08 in plugin_write (plugin=<optimized out>, ds=<optimized out>, vl=0x100200090) at plugin.c:1650
#1  0x00000001000067e7 in fc_bit_write_invoke (ds=0x7fff83a4b101 <__psynch_cvclrprepost+5>, vl=0x240056e429dafce5, meta=<optimized out>,
    user_data=<optimized out>) at filter_chain.c:708
#2  fc_default_action (ds=0x100200090, vl=0x1002003c8) at filter_chain.c:1041
#3  0x000000010000c9d9 in plugin_dispatch_values_internal (vl=<optimized out>) at plugin.c:1989
#4  plugin_write_thread (args=<optimized out>) at plugin.c:734
#5  0x00007fff909e4268 in _pthread_body () from /usr/lib/system/libsystem_pthread.dylib
#6  0x00007fff909e41e5 in _pthread_start () from /usr/lib/system/libsystem_pthread.dylib
#7  0x00007fff909e241d in thread_start () from /usr/lib/system/libsystem_pthread.dylib
#8  0x0000000000000000 in ?? ()
(gdb)
@octo octo modified the milestones: 5.3, 5.4 May 30, 2015
@digitalrinaldo
Copy link

@digitalrinaldo digitalrinaldo commented Jul 6, 2015

Is there any update on this issue. I am seeing this on OSX 10

/usr/local/Cellar/collectd/5.4.2/sbin/collectd -C /usr/local/etc/collectd.conf -T -f
[2015-07-06 07:54:20] cpu plugin: host_processors returned 4
[2015-07-06 07:54:20] Initialization of plugin `cpu' failed with status -1. Plugin will be unloaded.

@maikelvdh
Copy link

@maikelvdh maikelvdh commented Aug 18, 2015

Actually facing the same problem when running it as current active user, but seem to get it passing when running collectd as root. The mach_host_self() doesn’t return the privileged host_priv port to non-root users in fact.

@maireadmccabe
Copy link

@maireadmccabe maireadmccabe commented Oct 2, 2015

I'm running into the same issue on OS X 10, I was wondering if anybody has a work around as the cpu stats don't seem to be getting reported because of this issues. See below for messages found in syslog

cpu plugin: host_processors returned 4
Initialisation of plugin `cpu' failed with status -1. Plugin will be unloaded.

@ryan-williams
Copy link

@ryan-williams ryan-williams commented Nov 5, 2015

Same error here, collectd 5.5.0 on OSX 10.11.1, whether running collectd as my user or root.

Update: seems like it is actually reporting stats correctly now that I run as root; I guess I was mistaken!

@octo
Copy link
Member Author

@octo octo commented Nov 30, 2015

Thanks @maikelvdh and @ryan-williams, I'll improve the logged error message. If there's any way to get a processor_t without a privileged host control port, please let me know :)

—octo

octo added a commit that referenced this issue Nov 30, 2015
@rubenk
Copy link
Contributor

@rubenk rubenk commented Aug 3, 2016

I'm going to close this, since there's not much more we can from our point of view, sorry.

@rubenk rubenk closed this Aug 3, 2016
leifmadsen pushed a commit to leifmadsen/collectd that referenced this issue Apr 27, 2018
Make ignorelist_t public
@philippelatulippe
Copy link

@philippelatulippe philippelatulippe commented Sep 3, 2019

XRG uses a non-privileged call to retrieve CPU info:
https://github.com/mikepj/XRG/blob/f45e5b9a2d30816271d3f90d73bc937100c643b7/Data%20Miners/XRGCPUMiner.m

Maybe this issue could be re-opened as a feature request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.