Project

General

Profile

Xmltv.sock bad file descriptor

Added by m auk almost 7 years ago

Hi

Up until this week I have been using the below to send xmltv data without issue.

cat xmltv.xml | socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock

However now it fails with connection refused and the logs show:

Jan 21 06:29:38 MAUKv6 tvheadend2421: epggrab: module xmltv created
Jan 21 06:29:39 MAUKv6 tvheadend2421: xmltv: xmltv: failed to listen on socket: Bad file descriptor

Anyone seen this before?


Replies (10)

RE: Xmltv.sock bad file descriptor - Added by Robert Cameron almost 7 years ago

Sounds like it might be a permissions issue. Make sure Tvheadend is fully started and has created the socket before you start to write to it. Having socat attempt to write to the socket before Tvheadend creates it may create one with permissions that differ from what it is expecting.

If your guide update is part ofa service or script, consider modifying it to check for the existence of the socket (and the proper permissions) before executing.

Another option is to use a tv_grab_file script that satisfies the minimum responses needed by XMLTV packages to simply cat your XML file to stdout.

RE: Xmltv.sock bad file descriptor - Added by m auk almost 7 years ago

I've tried removing the xmltv.sock and restarting but still this bad descriptor issue:

Jan 21 07:41:18 MAUKv6 tvheadend9381: epggrab: module xmltv created
Jan 21 07:41:19 MAUKv6 tvheadend9381: xmltv: xmltv: failed to listen on socket: Bad file descriptor

RE: Xmltv.sock bad file descriptor - Added by M Rust almost 7 years ago

There is a small bug in the newest version.

In file src/epggrab/module.c find this line

if (listen(mod->sock, 5) != 0) {

and change it to

if (listen(sock, 5) != 0) {

This worked for me.

RE: Xmltv.sock bad file descriptor - Added by m auk almost 7 years ago

thanks for that - im having a little bit of trouble finding that file though?

RE: Xmltv.sock bad file descriptor - Added by m auk almost 7 years ago

upgraded this morning:

tvheadend -v
tvheadend: version 4.3-995~g9bdd747

still the same issue:

tvheadend[17793]: xmltv: xmltv: failed to listen on socket: Bad file descriptor

After heavy use of locate and grep -R i've still been unable to find where to modify:

if (listen(sock, 5) != 0) {

Anything i'm missing?

RE: Xmltv.sock bad file descriptor - Added by m auk almost 7 years ago

Robert Cameron wrote:

Another option is to use a tv_grab_file script that satisfies the minimum responses needed by XMLTV packages to simply cat your XML file to stdout.

For now I have switched from using socat and instead have modified tv_grab_file to cat the same xml - this seems to be working fine.

RE: Xmltv.sock bad file descriptor - Added by M Rust almost 7 years ago

m a wrote:

After heavy use of locate and grep -R i've still been unable to find where to modify:

if (listen(sock, 5) != 0) {

Anything i'm missing?

In order to patch the file to have to grab the tvheadend source via git and compile yourself.

RE: Xmltv.sock bad file descriptor - Added by Gene Stapp almost 7 years ago

M Rust wrote:0

In order to patch the file to have to grab the tvheadend source via git and compile yourself.

Do you know what version of master i need to downgrade to before that change to module.c was made?
I see that someone put in the patch request today:
[[https://tvheadend.org/projects/tvheadend/repository/revisions/8cfc0f0ac98be9a613915e80245056f8938b0723]]

RE: Xmltv.sock bad file descriptor - Added by K Shea almost 7 years ago

M Rust wrote:

In order to patch the file to have to grab the tvheadend source via git and compile yourself.

Unless you are somewhat of a Linux geek you probably aren't going to do that. Many, probably most Tvheadend users just get the precompiled version from the APT Repositories (https://tvheadend.org/projects/tvheadend/wiki/AptRepository) or one of the other repositories (https://tvheadend.org/projects/tvheadend/wiki/download).

For now probably the easiest solution, assuming you're not well-versed in the ways of Linux, would be to switch to using the tv_grab_file grabber script as suggested earlier in this thread. There are links to instructions for doing that in other recent threads on this board (posts within the last few days even). I've never had any problem using tv_grab_file to import XML listings into Tvheadend. It's a little different than using sockets (which is something I was never able to get working, though I didn't try very hard after the first failure), mainly because you need to set up Tvheadend to run the grabber on a specific schedule, but I just run my cron job to get the listings in the early AM hours, and then have Tvheadend run the grabber script several minutes later.

Of course if the very idea of compiling software doesn't cause you to break into a cold sweat, feel free to go for it.

RE: Xmltv.sock bad file descriptor - Added by Gene Stapp almost 7 years ago

actually it looks like the xmltv.sock issue has been fixed in most recent version. i just updated in the last half hour and now it is going through correctly.

    (1-10/10)