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

OPTIONS pings that are separated in time gradually converge #1133

Closed
MartinJPaterson opened this issue Mar 23, 2021 · 0 comments · Fixed by #1413
Closed

OPTIONS pings that are separated in time gradually converge #1133

MartinJPaterson opened this issue Mar 23, 2021 · 0 comments · Fixed by #1413
Labels
bug Something isn't working

Comments

@MartinJPaterson
Copy link
Contributor

MartinJPaterson commented Mar 23, 2021

Describe the bug
When investigating #1132, I manually set the ping_expires times in the sip_registrations table to all different values. About 20 minutes later they had converged on to mainly one value.

To Reproduce
Steps to reproduce the behaviour:

  1. Set <param name="all-reg-options-ping" value="true"/>
  2. Manually separate the ping_expires times: I did: update sip_registrations set ping_expires=ping_expires+round(random()*60);
  3. Wait. The times converge.

Expected behaviour
I would expect the times to remain separated out.

Package version or git hash

  • Version 1.10.5

Database output
ping_expires is a Unix timestamp. The starting point shown here has expires times between 11:35:24 & 11:36:17

sofia_reg_internal=# select sip_user, ping_expires from sip_registrations order by ping_expires;
 sip_user | ping_expires
----------+--------------
 001      |   1616499324
 001      |   1616499325
 8855     |   1616499327
 8835     |   1616499328
 001      |   1616499328
 8833     |   1616499329
 001      |   1616499330
 8836     |   1616499330
 401      |   1616499331
 8855     |   1616499333
 8838     |   1616499334
 8833     |   1616499335
 001      |   1616499335
 263      |   1616499335
 8855     |   1616499335
 001      |   1616499339
 8895     |   1616499341
 002      |   1616499344
 003      |   1616499344
 002      |   1616499345
 833      |   1616499348
 001      |   1616499350
 002      |   1616499350
 836      |   1616499350
 001      |   1616499353
 835      |   1616499353
 403      |   1616499354
 001      |   1616499354
 838      |   1616499355
 8833     |   1616499356
 8833     |   1616499358
 402      |   1616499364
 001      |   1616499364
 8836     |   1616499364
 003      |   1616499377
(35 rows)

20 minutes later many of the ping_expires are the same: (11:55:03)

sofia_reg_internal=# select sip_user, ping_expires from sip_registrations order by ping_expires;
 sip_user | ping_expires
----------+--------------
 8835     |   1616500503
 8836     |   1616500503
 8895     |   1616500503
 8838     |   1616500503
 838      |   1616500503
 835      |   1616500503
 263      |   1616500503
 403      |   1616500503
 001      |   1616500503
 002      |   1616500503
 8833     |   1616500503
 001      |   1616500503
 8855     |   1616500503
 836      |   1616500503
 001      |   1616500503
 002      |   1616500503
 402      |   1616500503
 001      |   1616500503
 001      |   1616500503
 002      |   1616500503
 8833     |   1616500503
 8855     |   1616500503
 001      |   1616500503
 833      |   1616500503
 8833     |   1616500503
 401      |   1616500503
 8855     |   1616500503
 003      |   1616500503
 001      |   1616500503
 001      |   1616500505
 001      |   1616500514
 003      |   1616500514
 001      |   1616500514
 8833     |   1616500514
 8836     |   1616500523
(35 rows)
@MartinJPaterson MartinJPaterson added the bug Something isn't working label Mar 23, 2021
yois615 added a commit to yois615/freeswitch that referenced this issue Oct 31, 2021
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.

Furthermore, rounding withing the code will ultimately
make the ping times converge over time.

This commmit will apply the random interval only during
registration of the endpoint.  All subsequent pings will
be incremented with the actual value of ping-mean-interval.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Oct 31, 2021
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.

Furthermore, rounding withing the code will ultimately
make the ping times converge over time.

This commmit will apply the random interval only during
registration of the endpoint.  All subsequent pings will
be incremented with the actual value of ping-mean-interval.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Nov 1, 2021
In randomization of numbers for ping intervals,
srand was called each time the randomization
function was called.  This is incorrect as all
the registrations were getting the same value
instead of a random one.

We move srand() to the beginning of the worker
thread launch in order to generate random numbers
correctly.

Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Nov 5, 2021
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Nov 23, 2021
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Jul 29, 2022
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Nov 20, 2022
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Nov 21, 2022
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
yois615 added a commit to yois615/freeswitch that referenced this issue Nov 21, 2022
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
greenbea pushed a commit to greenbea/freeswitch that referenced this issue Mar 28, 2023
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
Preston-PLB pushed a commit to Preston-PLB/freeswitch that referenced this issue Aug 14, 2023
In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes signalwire#1132, Fixes signalwire#1133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant