Home » U++ Library support » U++ SQL » SQL statements timeout in Linux (bug?)
SQL statements timeout in Linux (bug?) [message #50414] |
Wed, 24 October 2018 11:40 |
Giorgio
Messages: 218 Registered: August 2015
|
Experienced Member |
|
|
Hi there,
I have an application that uses a Postgres DB as backend. The application has been developed using a wired connection to the LAN, but now it is deployed to some clients using a wifi connection. With the wifi an issue arose: the timeout when issuing SQL statements.
All my routines that connect to a database (for select/update/insert) have the following structure:
int SaveData::TotalDrums(String c)
{
int retval;
SQL.ClearError();
try {
retval = SQL % Select(SqlSum(DRUMS))
.From(MYTABLE)
.Where( MYFIELD == AsString(c) );
} catch(SqlExc) {
retval = -1;
ErrorOK(t_("Error: ") + SQL.GetLastError());
}
return retval;
}
That worked well for a wired connection, but in a wifi environment sometimes the connection is unstable, so if the connection is lost, the application waits for it but if the timeout before the application "gives up" is too high, the application seems frozen and user thinks that it crashed. I made some test in Windows and in Linux Debian Stretch (the latest version of Debian). I launched the application (so it initially connects to the DB and "builds" the SQL global variable) and - before hitting a button that performs an insert into the DB - I detached the cable. In Windows the application stays idle for about 20 seconds, and after that period the SQL statement fails and the application prompts the dialog box explaining the error. In Debian the application stays idle for a very long time (during the test I sat in front of the monitor for ten minutes and the applications was still idle, so I got a coffe and when I came back, 20 minutes later, the error box was on the screen).
Is there a way to reduce the timeout, so the user does not feel like the application crashed?
Regards,
gio
|
|
|
Goto Forum:
Current Time: Tue Apr 23 08:27:26 CEST 2024
Total time taken to generate the page: 0.02153 seconds
|