mythtv-backend upstart config should wait for mysql

Bug #609402 reported by Richard Hansen
46
This bug affects 18 people
Affects Status Importance Assigned to Milestone
Mythbuntu
Fix Released
Undecided
Unassigned
mythtv (Ubuntu)
Fix Released
Undecided
Mario Limonciello

Bug Description

mythtv-backend requires mysql, so it should not start until mysql has started and it should stop when mysql is stopping.

Due to bug #608423 mysql fails to start on my machine. Because of the 'respawn' directive in /etc/init/mythtv-backend.conf, my /var/log/syslog was quickly filled with the following:

...
Jul 23 19:18:01 myth init: mythtv-backend main process (26729) terminated with status 254
Jul 23 19:18:01 myth init: mythtv-backend main process ended, respawning
Jul 23 19:18:04 myth init: mythtv-backend main process (26735) terminated with status 254
Jul 23 19:18:04 myth init: mythtv-backend main process ended, respawning
Jul 23 19:18:08 myth init: mythtv-backend main process (26741) terminated with status 254
Jul 23 19:18:08 myth init: mythtv-backend main process ended, respawning
...

and my /var/log/mythtv/mythbackend.log was filled with "Can't connect to MySQL server on 'myth' (111)" errors.

The attached patch modifies the upstart config file to wait until mysql starts before starting mythtv-backend and stop mythtv-backend when mysql is stopping.

Revision history for this message
Richard Hansen (rhansen) wrote :
Revision history for this message
Richard Hansen (rhansen) wrote :

I should note that I'm running 0.23.0+fixes25396.

Revision history for this message
Mario Limonciello (superm1) wrote : Re: [Mythbuntu-bugs] [Bug 609402] Re: mythtv-backend upstart config should wait for mysql

The problem with waiting on mysql is that this breaks on systems that don't
need mysql installed (slave backends).

On Sat, Jul 24, 2010 at 01:37, a7x <email address hidden> wrote:

> I should note that I'm running 0.23.0+fixes25396.
>
> --
> mythtv-backend upstart config should wait for mysql
> https://bugs.launchpad.net/bugs/609402
> You received this bug notification because you are a member of Mythbuntu
> Bug Team, which is subscribed to Mythbuntu.
>
> Status in Mythbuntu, Ubuntu derivative focused upon MythTV: New
>
> Bug description:
> mythtv-backend requires mysql, so it should not start until mysql has
> started and it should stop when mysql is stopping.
>
> Due to bug #608423 mysql fails to start on my machine. Because of the
> 'respawn' directive in /etc/init/mythtv-backend.conf, my /var/log/syslog was
> quickly filled with the following:
>
> ...
> Jul 23 19:18:01 myth init: mythtv-backend main process (26729) terminated
> with status 254
> Jul 23 19:18:01 myth init: mythtv-backend main process ended, respawning
> Jul 23 19:18:04 myth init: mythtv-backend main process (26735) terminated
> with status 254
> Jul 23 19:18:04 myth init: mythtv-backend main process ended, respawning
> Jul 23 19:18:08 myth init: mythtv-backend main process (26741) terminated
> with status 254
> Jul 23 19:18:08 myth init: mythtv-backend main process ended, respawning
> ...
>
> and my /var/log/mythtv/mythbackend.log was filled with "Can't connect to
> MySQL server on 'myth' (111)" errors.
>
> The attached patch modifies the upstart config file to wait until mysql
> starts before starting mythtv-backend and stop mythtv-backend when mysql is
> stopping.
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~mythbuntu-bugs
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~mythbuntu-bugs
> More help : https://help.launchpad.net/ListHelp
>

--
Mario Limonciello
<email address hidden>

Revision history for this message
Richard Hansen (rhansen) wrote :

Excellent point.

If I were to write up a patch, what do you think about adding a pre-start script that reads the backend config and pings the MySQL database until it replies (like /etc/init/mysql.conf does)?

Revision history for this message
Mario Limonciello (superm1) wrote :

My original plan was to wait until upstart grew support to conditionally start on jobs (only if they exist) which is supposed to hit on the next version.

Your solution does sound like a good contingency plan though. I would be quite open to a patch. I have two recommendations for it however:
1) make sure it sleeps in between tries
2) make sure that it times out eventually (after a few minutes or so) by causing the job to exit some non zero value. No use in continuously running the job if it's eventually going to fail anyway.

Changed in mythtv (Ubuntu):
assignee: nobody → a7x (a7x)
status: New → In Progress
Changed in mythbuntu:
status: New → Confirmed
status: Confirmed → Triaged
tags: added: patch
Leo Arias (elopio)
tags: added: patch-needswork
removed: patch
Revision history for this message
Leo Arias (elopio) wrote :

Changed the tag to patch-needswork because the attached patch was not accepted but suggestions for a better fix were given.

Revision history for this message
Mario Limonciello (superm1) wrote :

between tgm's patch and mine I think this should be fixed in bzr now.

Changed in mythtv (Ubuntu):
status: In Progress → Fix Committed
assignee: a7x (a7x) → Mario Limonciello (superm1)
Changed in mythbuntu:
status: Triaged → Fix Committed
Changed in mythbuntu:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mythtv - 1:0.24.0+fixes27305-0ubuntu1

---------------
mythtv (1:0.24.0+fixes27305-0ubuntu1) natty; urgency=low

  [ Mario Limonciello ]
  * New 0.24 checkout (27305)
  * Modify the upstart script to load the LANG first. (LP: #541042)
  * Modify configure_mythplugins_without_mythtv_installed.patch to remove
    SYSROOT from the mytharchive build process for it's additional support
    files. (LP: #674626)
  * Remove unused package, mythmovies from build process.
  * Clean up the dependencies of a few packages, and harden them to the binary
    version.
  * Disable XvMC as it's causing crashes. VDPAU is better off in these
    situations anyhow (LP: #660833)
  * Remove sparc support.
  * Make sure mysql is pingable before starting the backend (LP: #609402)
  * Fixup some linitians:
    - Extra license files
    - Longer extended descriptions
    - Duplicated synopsis
    - Init.d script
  * Add a new debian/rules rule called 'update-upstream-changelog'.
    This finds all of the most recent svn commit messages and
    creates changelog entries.
  * Add a debian/README.Debian for explaining how to work with the package.
  * In the update-upstream-changelog rule, search for the word mythbuntu
    in the version string. If found, find the latest version on the PPA
    to compare against.
  * Get rid of the newest-revision rule in favor of one that will actually
    update the changelog/checkout to the new version.
  * Add a new helper script debian/do-new-release.sh that will run all of
    these common tasks in preparation for an upload to ubuntu.

  [ Thomas Mashos ]
  * Set backend to not respawn if it dies 2 times in 1 hour (LP: #654846)
  * Move metadata scripts and internetcontent to mythtv-common
  * Fixed Replaces for mythtv-common
  * Added python and perl bindings as recommends for BE/FE
  * Fixes replaces in control.in for mythtv-common (LP: #676791)
  * Added bindings as recommends to FR and BE in control.in
  * Added Breaks mythtv-backend to mythtv-common (LP: #677206)
  * Added conflicts/replaces for mythplugins-dbg to mythtv-dbg
  * Added script to find latest mythtv svn revision in PPA
 -- Mario Limonciello <email address hidden> Sat, 20 Nov 2010 13:19:58 -0600

Changed in mythtv (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.