Mailing List Archive

GetMythDB()->GetDBManager()->popConnection(reuse) returns invalid database after Database object created: DBManager1
I hope this is OK to bring over here since it's getting right into the
code of MythTV.  If not, I will happily take it back to the -users
list.

In debugging my remote front-end connection problem, as was being
discussed in the -users list I have narrowed the problem down to

GetMythDB()->GetDBManager()->popConnection(reuse)

in MSqlQuery::InitCon() returning a MSqlDatabase * object where
the m_db.hostName().isEmpty() is true.

This seems to happen right after:

2016-07-19 17:35:17.888179 I Database object created: DBManager1

All of the queries that were done with DBManager0 succeeded prior to
that.

I wonder if anyone has any ideas why this might be happening?

A complete "-v database --loglevel debug" log, with my additional
debugging can be found at

http://www.interlinx.bc.ca/~brian/mythfe.debug

if you care to see the log.

Cheers,
b.
Re: GetMythDB()->GetDBManager()->popConnection(reuse) returns invalid database after Database object created: DBManager1 [ In reply to ]
On Tue, 2016-07-19 at 17:53 -0400, Brian J. Murrell wrote:
> I hope this is OK to bring over here since it's getting right into
> the
> code of MythTV.  If not, I will happily take it back to the -users
> list.

Figured it out.

The ping(host) MythContextPrivate::TestDBconnection was failing which
was causing SilenceDBerrors() to remove the database host from the
database params.

It's strange:

$ ping pvr
ping: icmp open socket: Operation not permitted

I will have to look into this more tomorrow.

It would also be nice if the logs were more clear that this is a/the
problem.  I will look into that and submit a patch if it's not already.

Cheers,
b.
Re: GetMythDB()->GetDBManager()->popConnection(reuse) returns invalid database after Database object created: DBManager1 [ In reply to ]
On Wed, Jul 20, 2016 at 1:06 AM, Brian J. Murrell <brian@interlinx.bc.ca> wrote:

> $ ping pvr
> ping: icmp open socket: Operation not permitted

perhaps ping does not have the proper capabilities set,
or perhaps not setuid for legacy distros? In either
case it suggests that something did not get installed
or configured correctly (which raises the question of
whether other the status of other items).
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: GetMythDB()->GetDBManager()->popConnection(reuse) returns invalid database after Database object created: DBManager1 [ In reply to ]
Suggestions:

• sudo chmod u+s `which ping`


• Set your local frontend to not try pinging first

(in ~/.mythtv/mysql.txt, uncomment:
#DBHostPing=no
in ~/.mythtv/config.txt, change this value to 0:
<Database>
<PingHost>1</PingHost>
)






On 20 Jul 2016, at 11:06 am, Brian J. Murrell <brian@interlinx.bc.ca> wrote:

> $ ping pvr
> ping: icmp open socket: Operation not permitted
>
> I will have to look into this more tomorrow.
>
> It would also be nice if the logs were more clear that this is a/the
> problem. I will look into that and submit a patch if it's not already.



--
Nigel Pearson, nigel@ind.tansu.com.au|Smart mice ... varmints|
Telstra Voice/Vid, Sydney, Australia |used vector formulas. |
Office: 8576 5449 Fax: 9298 9033 | How'd you catch them?|
Mobile: 0408 664435 Home: 9792 6998 |Smart cheese. |
Re: GetMythDB()->GetDBManager()->popConnection(reuse) returns invalid database after Database object created: DBManager1 [ In reply to ]
On Wed, 2016-07-20 at 03:00 +0000, Gary Buhrmaster wrote:
> 
> perhaps ping does not have the proper capabilities set,
> or perhaps not setuid for legacy distros?

It's something strange and new on Ubuntu Trusty.  This wasn't happening
on Precise.

In any case, I'm building diskless images with debootstrap and for
whatever reason, ping[6] are not getting their suid bit set.  Other
suid-set tools are.

There is an interesting bit of code in the postinstall for iputils-
ping:

for f in /bin/ping /bin/ping6; do
# if the admin has set an override, don't do anything at all
if ! dpkg-statoverride --list $f > /dev/null 2>&1; then
# Don't use setcap for Ubuntu as tarballs don't properly store those
# by default. LP: #1302192
if false; then
if echo "cap_net_raw+p" | setcap -q - $f; then
# remove the setuid bit!
chmod -s $f
fi
fi
fi
done

As you can see, that does remove the suid bit based on capabilities,
but as you can also see it's NOOP'd out with an "if false".

FWIW, I opened https://code.mythtv.org/trac/ticket/12831 with a patch
to be a bit more obvious about when the database ping is failing.

Cheers,
b.