Bug #1325

tvheadend 3.2 beta opens all files it can in home directory, then fails to find existing configuration settings

Added by Nick Tuckett about 9 years ago. Updated about 9 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Found in version:
3.2 beta
Affected Versions:


Symptoms when starting TVH:
  • A large number of ALERT messages appear in the log of the form "Unable to open XXX - Too many open files".
  • dvr logs "Creating new configuration ''" even though one already exists.
  • Checking open files via ls -la /proc/PID/fd shows 1024 entries.

This is running on a Raspberry Pi with Raspian (debian7-18-09-2012). Tuner is a USB Hauppage WinTV-Duet in dual tuner mode (driver is dvb_usb_dib0700).

Something in TVH or used by it is opening all these files and hitting the file handle limit, then failing to open subsequent files (e.g. the existing config files), causing a cascade of problems.

The open file entries correspond to pretty much all the files in the user account's home directory tree. Ironically I didn't notice this before as there were less than 1022 files present; it only showed up when adding the source for the 3.2 beta and building it!

When reducing the number of files in the home directory, TVH starts fine but still seems to grab a lot of file handles. Quite a number seem to be duplicates of file handles for /dev/dvb/adapterX entries.

Attached is an example file descriptor dump, not of the 1024 open files case but showing examples of the kind of unexpected file handles.


tvh_filehandles.txt (11.8 KB) tvh_filehandles.txt Nick Tuckett, 2012-10-13 15:02

Associated revisions

Revision 7b6ed15e (diff)
Added by Adam Sutton about 9 years ago

Fix open file handle bug and reduce mux config scan depth. Fixes #1325.

Revision 9b447c8e (diff)
Added by Adam Sutton about 9 years ago

Fix open file handle bug and reduce mux config scan depth. Fixes #1325.
(cherry picked from commit 7b6ed15eb9103dd4d70964bd37e6ea8bf5110221)



Updated by Nick Tuckett about 9 years ago

On further investigation, this looks to be down to the DVB scan path setting - it was pointed at the home directory. When set correctly, no mysterious open file handle entries were observed.

So original problem is a configuration issue; however it does seem that maybe TVH will "leak" file handles for files it doesn't recognise as DVB scan files?


Updated by Adam Sutton about 9 years ago

  • Category set to DVB
  • Status changed from New to Accepted
  • Assignee set to Adam Sutton
  • Target version set to 3.2

Agreed, good spot.

I can see the bug, will fix asap.



Updated by Adam Sutton about 9 years ago

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

Also available in: Atom PDF