[SERVER-8301] freebsd warning message on shell startup Created: 23/Jan/13  Updated: 11/Jul/16  Resolved: 19/Feb/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.3.2
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Eric Milkie
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: FreeBSD
Participants:

 Description   

Every time you start the mongo shell on FreeBSD, you see:

Wed Jan 23 18:41:49.077 Unable to collect Number of CPUs. (errno: 0 msg: No error: 0)



 Comments   
Comment by auto [ 19/Feb/13 ]

Author:

{u'date': u'2013-02-19T15:58:30Z', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-8301 fix handling of server info on FreeBSD

On FreeBSD 9, the number of cpus is only 4 bytes, but we are reading into an 8-byte value.
I relaxed the size check and also fixed up the error printing when something does go wrong.
Branch: master
https://github.com/mongodb/mongo/commit/e23de6dba57bb39fb80f5619a541ed6c0510546f

Comment by Scott Hernandez (Inactive) [ 19/Feb/13 ]

Great.

To answer your earlier questions, which you've already found:
We are calling sysctlbyname with "hw.ncpu" as the name. https://github.com/mongodb/mongo/blob/master/src/mongo/util/processinfo_freebsd.cpp#L44

Comment by Eric Milkie [ 19/Feb/13 ]

Oh I see now. This code is not quite right. The helper function can return EINVAL, instead of setting errno to EINVAL, so that's probably why errno is still 0 when we go to print it. I wonder what the right sizeof value is. I'll add some debugging statements.

Comment by Eric Milkie [ 19/Feb/13 ]

Just search the build logs for the message. The builder has 2 "Intel(R) Xeon(R)" CPUs, the machine type is amd64.
The release is 9.0-RELEASE #0 from Jan 5 2012.
I haven't looked at how we are gleaning this information in the code; are we just forking sysctl?

Comment by Scott Hernandez (Inactive) [ 19/Feb/13 ]

Eric, where did this come from? Can you run "sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'" on the host if you have access?

I can't seem to reproduce this on my freebsd 9.1 instance.

Generated at Thu Feb 08 03:17:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.