You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background:
In apputils.c we have get_system_number_of_cpus() which returns sysconf(_SC_NPROCESSORS_CONF)); (number of "configured" processors) and get_system_active_number_of_cpus() which returns sysconf(_SC_NPROCESSORS_ONLN); (number of "online/available" processors)
Then mainrelay.c sets turn_params.cpus to get_system_number_of_cpus() (capped at 128) and then also defaults general_relay_servers_number to this value.
Issue:
On most systems in most situations configured == online so the difference is meaningless. However, when running in some virtualized environments, the difference can be significant.
In one scenario when running under HyperV a VM configured for 2 CPUs, the hardware always reports a total of 240 total CPUs, with only the first 2 CPUs being online and the other 238 offline. Presumably this is how the host implements virtualized CPU hotplugging. From dmesg:
coturn correctly logs both the total (capped) and enabled CPU counts
0: (2341): INFO: System cpu num is 128
0: (2341): INFO: System enable num is 2
...but then proceeds with setting up 128 worker threads despite the system only having 2 CPUs. I believe this behavior is incorrect and instead turn_params.cpus should be set from get_system_active_number_of_cpus() instead.
The text was updated successfully, but these errors were encountered:
Background:
In
apputils.c
we haveget_system_number_of_cpus()
which returnssysconf(_SC_NPROCESSORS_CONF));
(number of "configured" processors) andget_system_active_number_of_cpus()
which returnssysconf(_SC_NPROCESSORS_ONLN);
(number of "online/available" processors)Then
mainrelay.c
setsturn_params.cpus
toget_system_number_of_cpus()
(capped at 128) and then also defaultsgeneral_relay_servers_number
to this value.Issue:
On most systems in most situations configured == online so the difference is meaningless. However, when running in some virtualized environments, the difference can be significant.
In one scenario when running under HyperV a VM configured for 2 CPUs, the hardware always reports a total of 240 total CPUs, with only the first 2 CPUs being online and the other 238 offline. Presumably this is how the host implements virtualized CPU hotplugging. From
dmesg
:And
getconf
:coturn
correctly logs both the total (capped) and enabled CPU counts...but then proceeds with setting up 128 worker threads despite the system only having 2 CPUs. I believe this behavior is incorrect and instead
turn_params.cpus
should be set fromget_system_active_number_of_cpus()
instead.The text was updated successfully, but these errors were encountered: