Bug #4088

idle mux scan stuck at certain mux

Added by Kai Sommerfeld 2 months ago. Updated 2 months ago.

Status:FixedStart date:2016-11-19
Priority:NormalDue date:
Assignee:Jaroslav Kysela% Done:


Target version:-
Found in version:4.1-2328 Affected Versions:


See attached log file. After some time idle mux scanning gets stuck at a certain mux. 100% reproducable on my end with two different tvh installations.

service.log - log file (116 KB) Kai Sommerfeld, 2016-11-19 16:55

Associated revisions

Revision f30b5049
Added by Jaroslav Kysela 2 months ago

mpegts scan: put tuned muxes to the end-of-queue, fixes #4088


#1 Updated by Kai Sommerfeld 2 months ago

I analysed this a bit more and think i found the problem:

It seems that initial mux scan works fine, but idle scan does not work at all, because the first mux (according to scan queue sort criteria) is scanned again and again, "forever".

Problem imo is the sorted scan queue. Mux scan works the way that first element of the scan queue is picked, scanned, and after the scan it gets removed from the queue and immediately put back into the queue, then.

For initial scan, all available muxes are inserted into the queue with weight 5 (INIT_SCAN_PRIORITY), which leads to following (simplified) queue content, according to the sort criteria:

(weight, polarization, frequency)
5 H 100000
5 H 100100
5 V 120000

After init scanning (5 H 100000), the respected element will be removed from the queue head and reinserted into the queue with weight 2 (IDLE_SCAN_PIORITY). This leads to the following queue content:

(weight, polarization, frequency)
5 H 100100
5 V 120000
2 H 100000

Next init scan iteration will pick (5 H 100100) scan, put back with weight 2 at tail of the queue, which is fine, and so on, until the last mux was processed by init scan. Queue content at this stage:

(weight, polarization, frequency)
2 H 100000
2 H 100100
2 V 120000

Now, (2 H 100000) will be scanned, removed and reinserted at exactly the same place in queue it was before (because no weight change this time) - at the head of the queue! And this lasts forever - scan (2 H 100000) - remove it - reinsert (2 H 100000) at head.

Due to this, no other mux will ever be idle scanned than the one at the head of the queue.

#2 Updated by Kai Sommerfeld 2 months ago

BTW, mux idle scan was broken by commit "mpegts scan: sort DVB-S muxes (for slave tuners)" (https://github.com/tvheadend/tvheadend/commit/0cc8b0becc061630510991b7b0e315ff173983db)

Asking, myself whether commit "epggrab: ota - sort muxes to improve scan algorithm" (https://github.com/tvheadend/tvheadend/commit/79c443206c1ad54f843e1be8976e9dda89e12d6e) causes similar problems for epggrab.

#3 Updated by Jaroslav Kysela 2 months ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Also available in: Atom PDF