Remote frontend can't access backend MySQL

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus » Wed Sep 17, 2014 12:20 am

MythTV Andriod Frontend (and likely others) access the backend using the Services API. It does not
connect to mysql. The Services API running in the backend accesses the DB as needed.
Thanks for the information. I kind of thought it was something like that. That method seems to he a lot less troublesome than directly accessing MySQL. I suppose the downside is that some functions are not supported by the services API.

aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus » Wed Sep 17, 2014 12:38 am

Myth has extensive logging available - see "mythfrontend -v help"

Try:

mythfrontend -v general, database, network --loglevel debug

on the frontend to check that it is configured correctly and doing what you expect.
And you can get detailed MySQL logs by adjusting your my.cnf.
Maybe they will help you to pinpoint the issue.

Re the user job: Are you getting log files from it ? Either add %VERBOSEMODE% to the job arguments or an explicit --logfile.

mythbackend --setverbose system; mythbackend --setloglevel debug

will change the logging of *your backend that is already running* and may give some clues.
Thanks for the hints about verbose logging. I'll give them a try and let you know what I find.

Concerning user job logging, I'm getting things like this in the backend log:
Sep 11 23:32:04 Pooh-2 mythbackend: mythbackend[4195]: I UserJob_6069 jobqueue.cpp:2409 (DoUserJobThread) JobQueue: Started User Job #1 for "The Daily Show With Jon Stewart":"Tavis Smiley" recorded from channel 2756 at 2014-09-12T06:00:00Z
Sep 11 23:32:04 Pooh-2 mythbackend: mythbackend[4195]: I UserJob_6069 jobqueue.cpp:2461 (DoUserJobThread) JobQueue: Finished User Job #1 for "The Daily Show With Jon Stewart":"Tavis Smiley" recorded from channel 2756 at 2014-09-12T06:00:00Z
This looks like the user job conpleted successfully, but no simlink is created. I'm using exactly the same commant that worked succssfully in my previously installation, and it works when I run it manually as user mythtv. Maybe verbose loggins will help.

User avatar
dizygotheca
Developer
Posts: 266
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: Remote frontend can't access backend MySQL

Post by dizygotheca » Wed Sep 17, 2014 8:57 am

I'm not familiar with mythlink but it's most likely your logfile permissions. However Myth logging can't tell you any more about it.

There are 2 statuses at play here.

1. Backend status: Myth can find the script, execute it and it terminates with a 0 exit status. Therefore it ran successfully and Myth can't tell you any more.

2. Script status: It's failing without reporting an error status and only its log will tell you why. When run (successfully) from the CLI (as user mythtv) it logs to the console, whereas a job will log to a file somewhere, depending on how your system is set up. If it has no permission to create/write that file then jobs will generally abort without an exit status. After an upgrade it's often as simple as just creating the logfile with appropriate permissions.

aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus » Wed Sep 17, 2014 9:15 pm

Thanks for the suggestion. It looks link mythlink.pl logs to standard out when --verbose is specified. I added this to the user job command and redirected to a log file owned by mythtv. I'll see what happens when the next scheduled program is recorded.

aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus » Thu Sep 18, 2014 7:50 am

I captured the output mythlink runs as a user job with verbose set (--verbose). This is the only thing sent to stdout and stderr:
Link destination directory: /home/mythtv/links
This is the correct destinaiton directory, but no symlink is created in that directory or anywhere else on the computer.

This is really puzzling. I can successfully run mythlink.pl from the command line as user mythtv, but when it runs as a user job it seems to complete without error but doesn't create a symlink. I think this eliminates the possibility of a permission problem and both the backend log, and the mythlink.pl log file that I created show that the script is successfully executed as a uer job.

Now what?

User avatar
dizygotheca
Developer
Posts: 266
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: Remote frontend can't access backend MySQL

Post by dizygotheca » Thu Sep 18, 2014 9:20 am

Oh, I see what you mean! It fails silently if it can't find the recording.

Could it be a UTC issue? ie, you've upgraded from pre-0.26 and you're not using %STARTTIMEUTC% in your user job. Seems to me the wiki is out of date...

When you run manually what starttime do you enter ? Where do you get it from ? And what is the local time/timezone for that sample ?

BTW: You can execute user jobs from the 'Watch Recordings' pop-up menu ('Job Options') to test it. You don't need to wait for a recording to come along.

aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus » Thu Sep 18, 2014 6:57 pm

Yes! It appears that the problem was %STARTTIMEUTC%. I made the change and successfully ran the user job from the "Watch Recordings" pop-up (thanks for the hint). Indeed, mythlink.pl fails silently. The log now shows:
Link destination directory: /home/mythtv/links
/home/mythtv/links/The Colbert Report- Viggo Mortensen-20140917-2331.mpg
rather than just the link destination line.

Thanks for your invaluable help.

Post Reply