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

Crashed Related to RTCM Connect Time #27

Open
tsawyer opened this issue Mar 27, 2017 · 2 comments
Open

Crashed Related to RTCM Connect Time #27

tsawyer opened this issue Mar 27, 2017 · 2 comments
Labels
bug pinned Pinned - Keeps stale issues from being auto closed

Comments

@tsawyer
Copy link
Contributor

tsawyer commented Mar 27, 2017

As RTCM nodes are connected to my hub upwards of 500 hours the connect time display becomes negative. Soon thereafter Asterisk begins to behave erratically and eventually crashes or requires a restart. Disconnecting and reconnecting a RTCM node to prevent exceeding that time prevents related crashes. Guessing this would be a chan_voter issue.

@tsawyer
Copy link
Contributor Author

tsawyer commented Jul 13, 2017

Looks like the fix has been discovered for this. The sample code below shows a bug which is caused by an operator precedence error (the typedef to "int"). Apparently this code is all over app_rpt and affects all node types. This is not just a chan_voter issue. This will go a long ways towards fixing a major source of long-term instability in app_rpt.

`
#include <stdio.h>

void main()
{
int hours, minutes, seconds;
long long connecttime, connecttime2;
char conntime[64];
int i;

// ORIGINAL CODE:

   printf ("Original Code:\n");

   connecttime2 = 4294967296L / 2 - 5000L;

   for (i = 0; i < 10; i++) {

           connecttime = connecttime2;

           hours = (int) connecttime/3600000;
           connecttime %= 3600000;
           minutes = (int) connecttime/60000;
           connecttime %= 60000;
           seconds = (int)  connecttime/1000;
           connecttime %= 1000;
           snprintf(conntime, 32, "%02d:%02d:%02d.%d", hours, minutes, seconds, (int) connecttime);
           conntime[32] = 0;

           printf ("time = %s\n", conntime);
           connecttime2 += 1000;
   }

// FIXED CODE:

   printf ("\n\nNew Code:\n");

   connecttime2 = 4294967296L / 2 - 5000L;

   for (i = 0; i < 10; i++) {

           connecttime = connecttime2;

           hours =  connecttime/3600000L;
           connecttime %= 3600000L;
           minutes =  connecttime/60000L;
           connecttime %= 60000L;
           seconds =  connecttime/1000L;
           connecttime %= 1000L;
           snprintf(conntime, 32, "%02d:%02d:%02d.%d", hours, minutes, seconds, (int) connecttime);
           conntime[32] = 0;

           printf ("time = %s\n", conntime);
           connecttime2 += 1000L;
   }

}
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////

[root@alarmpi tmp]# ./a.out
Original Code:
time = 596:31:18.648
time = 596:31:19.648
time = 596:31:20.648
time = 596:31:21.648
time = 596:31:22.648
time = -596:31:23.648
time = -596:31:24.648
time = -596:31:25.648
time = -596:31:26.648
time = -596:31:27.648

New Code:
time = 596:31:18.648
time = 596:31:19.648
time = 596:31:20.648
time = 596:31:21.648
time = 596:31:22.648
time = 596:31:23.648
time = 596:31:24.648
time = 596:31:25.648
time = 596:31:26.648
time = 596:31:27.648
`

@tsawyer
Copy link
Contributor Author

tsawyer commented Apr 30, 2018

Over time we've learned that this is issue impacts more than just RTCM the connect time display. Users with other hardware have reported crashes and disconnects occurring around the 600 hour mark. I've seen it with RTCM hardware because that's all I use. But I sense that any two nodes connected to each other on the same server will crash near the 600 hour mark.

@KG7QIN KG7QIN added the bug label Feb 22, 2020
@KG7QIN KG7QIN added the pinned Pinned - Keeps stale issues from being auto closed label Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pinned Pinned - Keeps stale issues from being auto closed
Projects
None yet
Development

No branches or pull requests

2 participants