[mythtv] [mythtv-commits] Ticket #1147: permissions problem -> coredump

Isaac Richards ijr at case.edu
Tue Jan 31 21:03:17 UTC 2006


On Tuesday 31 January 2006 15:52, Dag Nygren wrote:
> > On Tuesday 31 January 2006 14:54, Dag Nygren wrote:
> > > Yes, this is an unfortunate thing in MythTV. There are umpteens of
> > > functions calls where the return value is never checked, it is just
> > > assumed that everything is OK. (For example look at all the calls to
> > > InitCon() and the handling of the returned database pointer after
> > > this).
> > > This style is bound to create unnecessary bugs and crashes.
> >
> > Yeah, that's a great example.
> >
> > If your database isn't working, you have bigger issues.
>
> Sure, but we are talking networking here. You can never assume
> that a network connection stays up and running 100%, never.

Where's that assumption made?

> > Regardless, most of
> > the database queries _are_ checked for failure.
>
> Not all of them by far.
> I fixed one of my admittingly smallish problems by adding a check,
> but that was not accepted as a patch as this was a problem only for
> me and one other guy... (in TVRec::DoGetNextChannel() )

Looks like every single database hit in TVRec::DoGetNextChannel() checks for 
the successful operation of the queries to me.  Testing the databse 
connection separately gains absolutely nothing.

Your patch was rejected because it didn't do anything, and was obviously not 
correct.

> >It's completely unnecessary
> > to check to see if the database is working before trying to run the query
> > against it.  Worst case in that situation is that it tries to reconnect
> > and if it can't and the query still fails, well, that's probably already
> > being tested for.
>
> Really?
> MSqlQuery::exec() is not trying to reconnect but just pass the query on to
> QSqlQuery::exec() and then logs it. Can't see prepare( kicking the database
> either.

QSqlQuery does it internally.  'KickDatabase' is just an extra test, since 
QSqlQuery doesn't always retry the query on a reconnect properly.

Isaac


More information about the mythtv-dev mailing list