Bug #5760
'Clear all statistics' button does not clear disconnected channel stats
0%
Description
'api/status/inputclrstats' is only clearing connected channel stats. When reusing an old channel with errors those are still there.
It could lead to doubts when seeing old and new errors.
Files
History
Updated by Flole Systems about 5 years ago
What exactly do you mean by "connected channel stats"? You mean an IPTV tuner thats not shown in the tuner list when pressing the button?
Updated by Pablo R. about 5 years ago
Flole Systems wrote:
What exactly do you mean by "connected channel stats"? You mean an IPTV tuner thats not shown in the tuner list when pressing the button?
Yes!
Updated by Flole Systems about 5 years ago
I think those "tuners" should clear their stats anyways when they connect, there's no point in retaining the old error counters if they might aswell connect to a completely different server, unlike all other sources that have the tuner connected to the same thing all the time (same tuner/cable, same SAT-IP server or whatever) so it helps identify issues with a server or tuner here while on IPTV it doesn't as they can connect to something completely on retuning.
Updated by Pablo R. about 5 years ago
Flole Systems wrote:
I think those "tuners" should clear their stats anyways when they connect, there's no point in retaining the old error counters if they might aswell connect to a completely different server, unlike all other sources that have the tuner connected to the same thing all the time (same tuner/cable, same SAT-IP server or whatever) so it helps identify issues with a server or tuner here while on IPTV it doesn't as they can connect to something completely on retuning.
Thats true, but it also happens for IPTV channels. That should be auto cleaned on disconnection.
Also, I think all these counters are stored on tvheadend/webui side, not on tuner/remote server side.
Updated by Flole Systems about 5 years ago
Yeah maybe also on disconnection, I'd clear it before connecting so when using gdb you might still be able to see it.
Yes those tuners are local, but the point I'm trying to make is that "IPTV #1" might connect to www.example.org now and pick up errors there, disconnect and connect to www.notexample.org next time and then show the errors there, which would be confusing so clearing it completely on connect would be the way to go.
Updated by Flole Systems about 5 years ago
Sorry that was written quite bad: The tuner error counters are local of course.
Updated by saen acro about 5 years ago
In my case DVB-C
after restart and epg start to scan there is errors
value of errors restore few seconds after button used.
Updated by Flole Systems about 5 years ago
For me clearing works fine for SAT-IP and DVB-C, I haven't verified IPTV as I never got errors there (I'm not really using that, just for a few local surveillance cams)
Updated by Flole Systems about 5 years ago
Ah you are talking about uncorrected errors, I don't have those here, just continuity errors from time to time.
Anyways, to fix the original issue I came up with this (untested) patch, it could work or it could cause tvheadend to crash:
Add to src/input/mpegts/iptv/iptv.c:338
/* Reset Error Counters */
atomic_set(&mmi->tii_stats.unc, 0);
atomic_set(&mmi->tii_stats.cc, 0);
Updated by Flole Systems about 5 years ago
Actually try to add the following aswell to completely reset everything:
tvh_mutex_lock(&mmi->tii_stats_mutex);
mmi->tii_stats.te = 0;
mmi->tii_stats.ec_block = 0;
mmi->tii_stats.tc_block = 0;
tvh_mutex_unlock(&mmi->tii_stats_mutex);
Updated by Pablo R. about 5 years ago
I do not see at all bad that errors are saved, because if you are not on PC then you can review them.
What is wrong is that when you press the delete button some are not deleted, which is what causes doubt.
Updated by Flole Systems about 5 years ago
The problem is though for IPTV, you do not know which source they are from like I mentioned above: "IPTV #1" might connect to www.example.org now and pick up errors there, disconnect and connect to www.notexample.org next time and then show the errors there from example.org, which would be confusing so clearing it completely on connect would be the way to go. It would show errors on www.notexample.org while really example.org caused them.
They are not cleared because only "active"/existing tuners are found (are cleared), so clearing the IPTV tuners does not happen in the function that is called when the button is pressed. An IPTV tuner is created (or added) when its used and removed afterwards, that's why its not found.
Updated by Luis Alves about 5 years ago
Maybe change the stats to be "per mux" instead of "per adapter".
This change would fix the IPTV issue described above.
Updated by Jaroslav Kysela about 5 years ago
Those values are read from the driver (linuxdvb). We need to remember the old offset and compute only deltas like SAT>IP client does. Look for 'tii_stats.unc' updates in src/input/mpegts/linuxdvb/linuxdvb_frontend.c .
Updated by Pablo R. over 3 years ago
As far IPTV entries dissapears when channel is off the function is not clearing disconnected channels.
As Flole said, a solution could be reset error counters for iptv channels on start.