Scheduler Failure

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

Moderator: Forum Moderators

Post Reply
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Scheduler Failure

Post by BillK »

(Mythtv 31.0 on Ubuntu 20.04) Seemingly out of the blue, the scheduler crashed and programs stopped being recorded. The listings would not show anything to be recorded. Restarting the backend gets programs back on the schedule (and recorded) until the next time it crashes (in a day or so). It appears to be some kind of DB error, but there's nothing in the mysql error.log. Here's the backend log entries from when I think things went bad:
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: I Scheduler mythdbcon.cpp:419 (PurgeIdleConnections) New DB connection, total: 11
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: I Scheduler scheduler.cpp:2308 (HandleReschedule) Reschedule requested for PLACE PrepareToRecord
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: E Scheduler mythdbcon.cpp:843 (prepare) Error preparing query: DROP TABLE IF EXISTS sched_temp_record;
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: E Scheduler mythdbcon.cpp:845 (prepare) Driver error was [2/2013]:#012QMYSQL3: Unable to prepare statement#012Database error was:#012Lost connection to MySQL server during query
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: E Scheduler mythdb.cpp:181 (DBError) DB Error (Dropping sched_temp_record table):#012Query was:#012DROP TABLE IF EXISTS sched_temp_record;#012Driver error was [2/0]:#012QMYSQL: Unable to execute query#012Database error was:#012
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: E Scheduler mythdbcon.cpp:843 (prepare) Error preparing query: SELECT recordid, title, maxepisodes, maxnewest FROM sched_temp_record
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: E Scheduler mythdbcon.cpp:845 (prepare) Driver error was [2/0]:#012QMYSQL3: Unable to prepare statement#012Database error was:#012
May 18 07:59:00 Jupiter mythbackend: mythbackend[81751]: E Scheduler mythdb.cpp:181 (DBError) DB Error (CheckTooMany):#012Query was:#012SELECT recordid, title, maxepisodes, maxnewest FROM sched_temp_record#012Driver error was [2/0]:#012QMYSQL: Unable to execute query#012Database error was:#012
Last edited by bill6502 on Wed May 26, 2021 4:30 am, edited 1 time in total.
Reason: Corrected OS version from 18.04 to 20.04 per later post
Gribnif
Junior
Posts: 88
Joined: Wed May 14, 2014 12:46 pm
United States of America

Re: Scheduler Failure

Post by Gribnif »

You should look for errors in the MySQL error log. I'm not sure where Ubuntu puts it, but you can try /var/log/mysqld.log. It could be that one or more of your tables is in need of repair.
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

The only mysql log file is /var/log/mysql/error.log, and as I said, there's nothing in any of them.I haven't seen any problems with other apps using mysql, and it's odd that it's OK after I restart the backend.
User avatar
bill6502
Developer
Posts: 2308
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Scheduler Failure

Post by bill6502 »

Hi, in both comments, you mention that there's nothing in error.log. Does that mean
absolutely no data, or nothing of interest to the issue? If the log is empty, then I'd
verify that it's writable. Mine permissions look like this:

Code: Select all

drwxr-s--- 2 mysql adm 4096 May 18 00:06 /var/log/mysql
-rw-r----- 1 mysql adm 3684 May 18 20:04 /var/log/mysql/error.log
Another option would be: journalctl --boot=0 --no-pager --unit=mysql

When MythTV is failing, can you execute the query from the command line:
DROP TABLE IF EXISTS sched_temp_record; ?

Is there plenty of space in /tmp? You can also try to create the table of
interest: CREATE TEMPORARY TABLE sched_temp_record LIKE record;
User avatar
stuarta
Developer
Posts: 220
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

Re: Scheduler Failure

Post by stuarta »

I would run a database check in the first instance.
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

The current mysql error.log is empty (0 bytes). There is data in a previous log from when the system was rebooted (May 15).
$ journalctl --boot=0 --no-pager --unit=mysql
-- Logs begin at Sun 2021-02-14 18:40:25 EST, end at Wed 2021-05-19 10:36:09 EDT. --
May 15 00:04:14 Jupiter systemd[1]: Starting MySQL Community Server...
May 15 00:04:24 Jupiter systemd[1]: Started MySQL Community Server.
$ df /tmp
/dev/sdc1 29226900 9734856 17984360 36% /
$ mysql --login-path=mythtv -D mythconverg
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2491
Server version: 8.0.22-0ubuntu0.20.04.2 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> DROP TABLE IF EXISTS sched_temp_record;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TEMPORARY TABLE sched_temp_record LIKE record;
Query OK, 0 rows affected (0.00 sec)

mysql> DROP TABLE IF EXISTS sched_temp_record;
Query OK, 0 rows affected (0.00 sec)
The good news is that programs are being scheduled for recording to the end of mythfilldatabase downloaded data.

p.s. The ubuntu version I stated initially was incorrect. The server is running on ubuntu 20.04.
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

stuarta wrote:
Wed May 19, 2021 10:54 am
I would run a database check in the first instance.
~$ mysqlcheck --login-path=mythtv -r mythconverg
mythconverg.bdbookmark OK
mythconverg.capturecard OK
mythconverg.cardinput OK
mythconverg.channel OK
mythconverg.channelgroup OK
mythconverg.channelgroupnames OK
mythconverg.channelscan OK
mythconverg.channelscan_channel OK
mythconverg.channelscan_dtv_multiplex OK
mythconverg.codecparams OK
mythconverg.credits OK
mythconverg.customexample OK
mythconverg.diseqc_config OK
mythconverg.diseqc_tree OK
mythconverg.displayprofilegroups OK
mythconverg.displayprofiles OK
mythconverg.dtv_multiplex OK
mythconverg.dtv_privatetypes OK
mythconverg.dvdbookmark OK
mythconverg.dvdinput OK
mythconverg.dvdtranscode OK
mythconverg.eit_cache OK
mythconverg.filemarkup OK
mythconverg.gallery_directories OK
mythconverg.gallery_files OK
mythconverg.gallerymetadata
note : The storage engine for the table doesn't support repair
mythconverg.housekeeping OK
mythconverg.inputgroup OK
mythconverg.internetcontent OK
mythconverg.internetcontentarticles OK
mythconverg.inuseprograms OK
mythconverg.iptv_channel OK
mythconverg.jobqueue OK
mythconverg.jumppoints OK
mythconverg.keybindings OK
mythconverg.keyword OK
mythconverg.livestream OK
mythconverg.logging OK
mythconverg.music_albumart
note : The storage engine for the table doesn't support repair
mythconverg.music_albums
note : The storage engine for the table doesn't support repair
mythconverg.music_artists
note : The storage engine for the table doesn't support repair
mythconverg.music_directories
note : The storage engine for the table doesn't support repair
mythconverg.music_genres
note : The storage engine for the table doesn't support repair
mythconverg.music_playlists
note : The storage engine for the table doesn't support repair
mythconverg.music_radios
note : The storage engine for the table doesn't support repair
mythconverg.music_smartplaylist_categories
note : The storage engine for the table doesn't support repair
mythconverg.music_smartplaylist_items
note : The storage engine for the table doesn't support repair
mythconverg.music_smartplaylists
note : The storage engine for the table doesn't support repair
mythconverg.music_songs
note : The storage engine for the table doesn't support repair
mythconverg.music_stats
note : The storage engine for the table doesn't support repair
mythconverg.mythlog OK
mythconverg.mythweb_sessions
note : The storage engine for the table doesn't support repair
mythconverg.oldfind OK
mythconverg.oldprogram OK
mythconverg.oldrecorded OK
mythconverg.people OK
mythconverg.pidcache OK
mythconverg.playgroup OK
mythconverg.powerpriority OK
mythconverg.profilegroups OK
mythconverg.program OK
mythconverg.programgenres OK
mythconverg.programrating OK
mythconverg.recgrouppassword OK
mythconverg.recgroups OK
mythconverg.record OK
mythconverg.record_tmp
note : The storage engine for the table doesn't support repair
mythconverg.recorded OK
mythconverg.recordedartwork OK
mythconverg.recordedcredits OK
mythconverg.recordedfile OK
mythconverg.recordedmarkup OK
mythconverg.recordedprogram OK
mythconverg.recordedrating OK
mythconverg.recordedseek OK
mythconverg.recordfilter OK
mythconverg.recordingprofiles OK
mythconverg.recordmatch OK
mythconverg.scannerfile OK
mythconverg.scannerpath OK
mythconverg.settings OK
mythconverg.storagegroup OK
mythconverg.tvchain OK
mythconverg.tvosdmenu OK
mythconverg.upnpmedia OK
mythconverg.user_permissions OK
mythconverg.user_sessions OK
mythconverg.users OK
mythconverg.videocast OK
mythconverg.videocategory OK
mythconverg.videocollection OK
mythconverg.videocountry OK
mythconverg.videogenre OK
mythconverg.videometadata OK
mythconverg.videometadatacast OK
mythconverg.videometadatacountry OK
mythconverg.videometadatagenre OK
mythconverg.videopart OK
mythconverg.videopathinfo OK
mythconverg.videosource OK
mythconverg.videotypes OK
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

Another bit of information that may or may not be relevant is that the DBError is coming up at exactly the same time every day (07:59:00).
nouglywires
Junior
Posts: 20
Joined: Sun Nov 23, 2014 7:17 pm
United States of America

Re: Scheduler Failure

Post by nouglywires »

See the next thread - viewtopic.php?f=36&t=4453

Can you fix this by restarting the backend? sudo systemctl restart mythtv-backend
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

nouglywires wrote:
Thu May 20, 2021 3:58 pm
See the next thread - viewtopic.php?f=36&t=4453

Can you fix this by restarting the backend? sudo systemctl restart mythtv-backend
Asked and answered.

I saw that other thread but since my recordings weren't disappearing, i didn't look into it.
nouglywires
Junior
Posts: 20
Joined: Sun Nov 23, 2014 7:17 pm
United States of America

Re: Scheduler Failure

Post by nouglywires »

In that other thread, recorded programs are not disappearing.

But following the [daily] mythfilldatabase run, "upcoming recordings" is empty, and nothing new is recorded.
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

My mythfilldatabase runs about noon. The DBError scheduler failure is occurring at 07:59:00. Very odd.
BillK
Senior
Posts: 129
Joined: Tue Dec 09, 2014 9:49 pm
United States of America

Re: Scheduler Failure

Post by BillK »

I wrote a script to restart the backend if nothing is being recorded and scheduled it for 08:15 (after the 07:59:00 DBError). Today, a program that would have been recorded at 08:00 started recording right after the backend restart.
User avatar
pgbennett
Developer
Posts: 503
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Scheduler Failure

Post by pgbennett »

See this topic, where there is a theory that this was triggered by a database upgrade

viewtopic.php?f=36&t=4453#p21895
Post Reply