application freezes under linux/Kylix when MySql server down

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
carlotoffolon
Posts: 5
Joined: Thu 14 Sep 2006 14:53

application freezes under linux/Kylix when MySql server down

Post by carlotoffolon » Fri 02 Feb 2007 17:56

Hi to all.
I have a simple but serious problem:

I have a PC running under Linux (Debian 3.1) with the application, ad another (XP) with MySql server.

My app opens a connection and a table, and everithings works fine.

After that I disconnect the server (by unplug the lan cable).

At this point when I try to make MyConn.Ping (or any other command like Table1.Active:=True, etc. ) the application freezes, even if I put MyConn.Ping in a Try...Except statement.

Note that MyConn1.ConnectionTimeOut is set to 15 and Table.CommandTimeOut is set to 10

I've put the Ping in a timer:
Try
MyConn1.Ping;
Except
// This never happens !!!!
Caption:='Errore ' + TimeToStr(Now);
End;

Whe I reconnect the cable on the server (sometimes) the application starts goin well again...

Question is:
How can I check if the connection is REALLY connected (when .Ping seems that does not work under Linux)?

My MyDac version is 4.40.0.20 running under Kylix3.

Thank You,
Carlo

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 06 Feb 2007 11:16

Please perform the following experiment:
- place the TMyQuery component onto the form (MyQuery1);
- set the CommandTimeOut property of MyQuery1 to a small value, for example 5;
- run the application;
- connect to server;
- unplug network cable;
- execute a command by MyQuery1;
- note the query execution time.

Inform us if the error is raised and the expired time corresponds to the assigned value.

carlotoffolon
Posts: 5
Joined: Thu 14 Sep 2006 14:53

Post by carlotoffolon » Thu 12 Jul 2007 09:12

Hi,

I tried the experiment as you suggested
and after unplug network cable
and after execute a command by MyQuery1
the application freezes for about 15 minutes.
When I reconnect the cable on the server the application starts goin well again...

I think MyConnection.ConnectionTimeOut and MyQuery.CommandTimeout
don't work on Linux.

On Windows the same application works fine.

Any suggestions ?

Thanks in adavance

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 13 Jul 2007 14:19

Unfortunately this is a restriction of your operating system. MyDAC uses the operating system setsockopt function with the SO_RCVTIMEO parameter to set socket timeout, but this parameter is read-only for Linux. So, MyDAC cannot set the socket timeout under Linux.

bohnzinho
Posts: 1
Joined: Wed 03 Oct 2007 13:16

Post by bohnzinho » Wed 03 Oct 2007 13:26

Hi,

I solve this problem on linux, executing the following commands:

echo 1 > /proc/sys/net/ipv4/tcp_retries1
echo 1 > /proc/sys/net/ipv4/tcp_retries2


Make this and the MyDac create an exception when I unplug the lan cable. I use MyDac with Kylix3, acessing one server with linux/oracle.

Post Reply