Page 1 of 1

problem with tunnel.php

Posted: Mon 17 Nov 2014 14:24
by pincopallino
Hi,
using Unidac 5.5.12 of D7 to connect to MySQL.
I have a local test (virtual) machine and a remote server. The test machine has also normal tcp access to mysql so I can test the software and it's working.

With the local machine the tunnel is working almost as expected.
With the remote no!
I got (ever) an error
'Error on data reading from the connection:'#$D#$A
'A blocking operation was interrupted by a call to WSACancelBlockingCall.'#$D#$A
'Socket Error Code: 10004($2714)'
inside this function TCRHttp.ReadLine: string;
I continued and after this I got an Integer Overflow error at

Code: Select all

function TCRVioTcp.TryConnect: Boolean;
line 306: LongWord(FConnectionTimeout)
after some debugging I found the source:

Code: Select all

MySQLApiUni.pas
procedure TMySQLAPI.SetTimeout(pmysql: PMYSQL_CON; Timeout: integer);
Line 1739

    Timeout := 365*24*3600; // CLIENT_NET_READ_TIMEOUT, mysql.h
You are setting a timeout of 1 year! This is, obviously, wrong...
Note:
1) that I found this error because recompiled the source with Range checking and Overflow checking active;
2) the SetTimeout call is done AFTER the connection tentative!

Now the main problem is that the timeout I set is not respected

Code: Select all

 UCMyRemote.SpecificOptions.Values['ConnectionTimeout']  := '300';
the entire operation is aborted in less than 6 seconds (included an ftp session).

In conclusion I think that with a fast server the component can comunicate also if the timeout setting are broken...
Thanks

Re: problem with tunnel.php

Posted: Fri 21 Nov 2014 09:34
by ViktorV
The Timeout value equals 31536000 only when a user sets timeout properties (ConnectionTimeout, CommandTimeout) to 0 in UniDAC. Make sure you don't set timeout to 0 anywhere. If you do - set timeout to a not null value.