Mailing List Archive

Database server and pings (r14205)
Hey

As far as I've found out Revision 14205 adds a check that pings the
database server before connecting to it. If it dont get a response on
the ping check, it jumps directly to database prompting.

IMO the idea is good, but there should be some way to bypass this check
as some servers\routers ignores pings. If you have a database on a
server that ignores the ping request you wont be able to connect at all
with this patch. (Unless I'm missing something vital)


---
Ivar
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
Hi Ivar.


> IMO the idea is good, but there should be some way to bypass this
> check
> as some servers\routers ignores pings.

Sorry, I hadn't thought about that!


Would a parameter in mysql.txt,
or another command-line switch, be enough?

--
Nigel Pearson, nigel@ind.tansu.com.au|"Things you own-
Telstra Net. Eng., Sydney, Australia | end up owning you"
Office: 9202 3900 Fax: 9261 3912 | Tyler,
Mobile: 0408 664435 Home: 9792 6998 | Fight Club
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
On 8/16/07, Nigel Pearson <nigel@ind.tansu.com.au> wrote:

> > IMO the idea is good, but there should be some way to bypass this
> > check as some servers\routers ignores pings.
>
> Sorry, I hadn't thought about that!
>
>
> Would a parameter in mysql.txt,
> or another command-line switch, be enough?

Is it possible to ping the database the same way that mysqladmin does?
For example, when you run:

mysqladmin ping -h HOST -u USER -pPASSWORD

The mysqladmin program pings the MySQL server on the SQL server port
(default 3306). It doesn't use conventional ICMP pings, it uses TCP
instead.

--
Joe Ripley
vitaminjoe@gmail.com
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
> Is it possible to ping the database the same way that mysqladmin does?
> For example, when you run:
>
> mysqladmin ping -h HOST -u USER -pPASSWORD


Possible, but it doesn't fix the problem that
I was trying to detect using the ping test:


% time mysqladmin ping -h 127.0.0.2
mysqladmin: connect to server at '127.0.0.2' failed
error: 'Lost connection to MySQL server during query'
mysqladmin ping -h 127.0.0.2 0.00s user 0.01s system 0% cpu 1:14.85
total

%


Anything that uses TCP will take ages (minutes on most OSs).


--
Nigel Pearson, nigel@ind.tansu.com.au|"Now the world has gone to bed.
Telstra Net. Eng., Sydney, Australia | Darkness won't engulf my head.
Office: 9202 3900 Fax: 9261 3912 | I can see by infrared.
Mobile: 0408 664435 Home: 9792 6998 | How I hate the night." -Marvin
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
On 8/16/07, Nigel Pearson <nigel@ind.tansu.com.au> wrote:

> Anything that uses TCP will take ages (minutes on most OSs).

Indeed. My own similar test had even worse results:

error: 'Lost connection to MySQL server during query'

real 3m9.004s
user 0m0.004s
sys 0m0.004s

Three minutes is a long time. :)

--
Joe Ripley
vitaminjoe@gmail.com
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
On 8/16/07, Joe Ripley <vitaminjoe@gmail.com> wrote:
> On 8/16/07, Nigel Pearson <nigel@ind.tansu.com.au> wrote:
>
> > Anything that uses TCP will take ages (minutes on most OSs).
>
> Indeed. My own similar test had even worse results:
>
> error: 'Lost connection to MySQL server during query'
>
> real 3m9.004s
> user 0m0.004s
> sys 0m0.004s
>
> Three minutes is a long time. :)

I would imagine we could do something akin to

ping server
if fail, run a connect with a really really fast timeout (15 seconds?)
if that fails, then ask for db settings?

Just a thought
~Rob
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
On 8/16/07, Nigel Pearson <nigel@ind.tansu.com.au> wrote:
>
>
> Hi Ivar.
>
>
> > IMO the idea is good, but there should be some way to bypass this
> > check
> > as some servers\routers ignores pings.
>
> Sorry, I hadn't thought about that!
>
>
> Would a parameter in mysql.txt,
> or another command-line switch, be enough?


I think something in mysql.txt would be the best as it allows for permanent
configuration without messing with command-line options. I mean, anyone who
is setting up a mysql system that doesn't respond to pings is probably doing
something out of the ordinary anyways and can handle making a change like
this to their system.

Kevin
Re: Database server and pings (r14205) [ In reply to ]
Kevin Kuphal skrev:
> On 8/16/07, *Nigel Pearson* <nigel@ind.tansu.com.au
> <mailto:nigel@ind.tansu.com.au>> wrote:
>
>
> Hi Ivar.
>
>
> > IMO the idea is good, but there should be some way to bypass this
> > check
> > as some servers\routers ignores pings.
>
> Sorry, I hadn't thought about that!
>
>
> Would a parameter in mysql.txt,
> or another command-line switch, be enough?
>
>
> I think something in mysql.txt would be the best as it allows for
> permanent configuration without messing with command-line options. I
> mean, anyone who is setting up a mysql system that doesn't respond to
> pings is probably doing something out of the ordinary anyways and can
> handle making a change like this to their system.
>
> Kevin
>
>

Yeah, and prehaps have a question in the database prompt thingy that
appears after a failed ping. "Does your mySQL server reply to ICMP
pings? [Yes\No].

--
Ivar
Re: Database server and pings (r14205) [ In reply to ]
Currently if you leave the DBPort setting blank it will use the default
port of 3306.
However, your recent changes have broken this since the ping check reads
the default port as 0 and complains that it cannot access the database
(when in reality it can).

I was going to patch this but I'm not sure what the best solution is:
1. Make it mandatory that the port is specified?
2. Make a special case for default in the ping check?

Cheers,
Matthew


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
> However, your recent changes have broken this since the ping check
> reads
> the default port as 0 and complains that it cannot access the database
> (when in reality it can).

Hmmm.

1) I have only been able to reproduce this by
manually adding a DBPort=0 line in mysql.txt.
If there is no DBPort= line, or if it has no value,
TestDBconnection() will have port.length() == 0,
and there is no telnet (port check).

2) I cannot see why DBPort=0 would be in the file,
because the settings UI doesn't write a DBPort line
if the value entered is blank or 0?


But, I have checked in [14224] which
should skip the check in your case?

--
Nigel Pearson, nigel@ind.tansu.com.au| I've been talking to-
Telstra Net. Eng., Sydney, Australia | the ship's computer.
Office: 9202 3900 Fax: 9261 3912 | ... It hates me!
Mobile: 0408 664435 Home: 9792 6998 | Marvin


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
On 17/08/2007, at 2:37 PM, Rob Smith wrote:
> I would imagine we could do something akin to
>
> ping server
> if fail, run a connect with a really really fast timeout (15 seconds?)
> if that fails, then ask for db settings?

Apart from the 15s timeout, that is what we currently do.

I wanted to have the same timeout on the ping and telnet,
(er, connect), but was too lazy to use anything harder
than MythSocket::connect() in telnet().

If anyone has sufficient motivation to add a timeout code
to either of those, it would make misconfigured startups
just that bit nicer.

--
Nigel Pearson, nigel@ind.tansu.com.au|"Beware - I am a carrier
Telstra Net. Eng., Sydney, Australia | of surrealism"
Office: 9202 3900 Fax: 9261 3912 | D A
Mobile: 0408 664435 Home: 9792 6998 | L I
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
Re: Database server and pings (r14205) [ In reply to ]
On 18/08/2007, at 8:55 PM, Ivar Eriksen wrote:

> Yeah, and prehaps have a question in the database prompt thingy
> that appears after a failed ping. "Does your mySQL server reply to
> ICMP pings? [Yes\No].

I didn't want to add such an "expert level" question in a PopUp,
because in the majority of cases the problem is just a typo,
broken local networking, et c.

Revision 14239 now has a UI switch, in the database setup page,
to turn off pinging, and mention of ICMP pings in the help.

--
Nigel Pearson, nigel@ind.tansu.com.au|"Beware - I am a carrier
Telstra Net. Eng., Sydney, Australia | of surrealism"
Office: 9202 3900 Fax: 9261 3912 | D A
Mobile: 0408 664435 Home: 9792 6998 | L I
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev