[tor-bugs] #8002 [Tor]: Mis-count of CPUs

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jan 19 13:38:51 UTC 2013


#8002: Mis-count of CPUs
-------------------------+--------------------------------------------------
 Reporter:  tmpname0901  |          Owner:                    
     Type:  defect       |         Status:  new               
 Priority:  normal       |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor          |        Version:  Tor: 0.2.3.25     
 Keywords:  SMP          |         Parent:                    
   Points:               |   Actualpoints:                    
-------------------------+--------------------------------------------------
 On start-up Tor v0.2.3.25/Linux says:

 "[notice] Wow!  I detected that you have 64 CPUs. I will not autodetect
 any more than 16, though.  If you want to configure more, set NumCPUs in
 your torrc"

 This is in a CentOS6/OpenVZ VPS with only a single virtual CPU.  Tor
 config param NumCPUs is not used.

 It turns out that OpenVZ, since version rhel6/042stab061.2, lists all the
 *host* CPUs in /sys/devices/system/cpu/.  It is this number of processors
 that is returned by the sysconf(_SC_NPROCESSORS_CONF) that Tor uses in
 ~/tor-0.2.3.25/src/common/compat.c to determine CPU count.

 From the command line:

 # getconf _NPROCESSORS_ONLN
 1

 Programmatically:

 $ /tmp/main
 sysconf() says: 64
 Wow, too many CPUs: 64

 I know that there's not much you can do about a sysconf() that lies.  I
 want to get this on the record, though, for the sake of Tor's future auto-
 scaling.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8002>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list