[mythtv-commits] Ticket #9792: Deadlocked scheduler

MythTV noreply at mythtv.org
Thu Aug 4 20:18:53 UTC 2011


#9792: Deadlocked scheduler
----------------------------------------+----------------------------
 Reporter:  warped <warpme@…>           |          Owner:
     Type:  Bug Report - Hang/Deadlock  |         Status:  new
 Priority:  minor                       |      Milestone:  unknown
Component:  MythTV - General            |        Version:  Trunk Head
 Severity:  medium                      |     Resolution:
 Keywords:                              |  Ticket locked:  0
----------------------------------------+----------------------------

Comment (by Github):

 Fix SQL reconnection logic. Refs #9704. Refs #9773. Refs #9792.

 What this does is get rid of the old KickDatabase() logic and replaces it
 with a simple reconnect if the DB socket is disconnected, and also gets
 rid of a recent re-enablement of the automatic reconnects in [dd2d7a14d1]
 and importantly it extends the reconnection logic in [528324d8ba] so that
 it resends the prepare() and rebinds the bindings when a reconnect happens
 in an exec().

 This also makes the QSqlQuery parent of MSqlQuery private and adds some
 wrappers so we can prevent MSqlQuery users from accessing methods that
 may invalidate some assumption in MSqlQuery + it adds debugging wrappers
 for first(), last(), previous(), and seek() like we already had for
 next().

 A little bit of history is in order.

 In Qt3 the SQL driver automatically reconnected whenever a connection was
 lost.
 But the first query after this auto-reconnect always failed. So in 2003
 mdz
 added KickDatabase() which would recover disconnect and reconnect an
 automatically all was good with the world.

 In Qt4 the QSqlQuery::prepare() started to actually do prepared statements
 instead of emulating them. This caused a small problem in now it was
 possible
 that a disconnect happened between the call to prepare() and exec() and
 then
 the exec() would fail. But odds of this were still pretty low for most
 uses
 of the database in MythTV. But at some point trolltech also got rid of the
 automatic reconnections which caused us trouble in Qt3. To fix this we
 added
 reconnection logic in [528324d8ba] and this is where the real trouble
 began.
 While this reconnection logic really does exactly the same thing that the
 auto-reconnection logic did in Qt3, the fact that prepare() doesn't just
 emulate
 prepared statements in Qt4 means that it's now that when we reconnect to
 the
 database in exec() the prepared statement has not been sent to the
 database.

 Note: This should be back-ported to 0.24-fixes after a reasonable burn-in
 time in master.
  Branch:    master
  Changeset: 4dfcdb8dd0c80d096ed95d5eccd489c692efa90d

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/9792#comment:16>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list