Status: Need More Info
Priority: P3: Somewhat important
Affects Version/s: 5.13.1
Fix Version/s: None
Component/s: SQL Support
Environment:Win7 32bit 4 GB RAM, OpenVpn
In normal situation, locally or over LAN, when executing:
query = QSqlQuery()
success = query.exec("some SELECT SQL command")
when query fails it returns false and everything is ok. I can choose what to do next. I usually have some loop with some delay and try more times and it executes finally.
When executing this over OpenVPN, expecting 25,000+ records, query.exec() just freezes and freezes my desktop app. QSqlQuery::exec() is a black box, it certainly has some built-in timeout, because over LAN it relatively quickly returns false. One would expect it to do the same over OpenVPN. The loop here doesn't help, because exec() freezes.
Moreover, after freeze, I have to kill the app and reconnect OpenVPN in order for connection to database and queries to work. Even psql doesn't work any more.
As I can see, QSqlQuery::exec() doesn't let us parameterize timeout. It is hardcoded. But in this situation it wouldn't help, because the timeout activates locally or over LAN, but doesn't get the chance to activate over OpenVPN.
This only happens with SELECT queries over OpenVPN that expect 25,000+ records in that query. For smaller queries, it works ok.
I investigated Postgres QSqlQuery::setConnectOptions() but like you, I couldn't find anything of help.
I think it is a Qt bug. QSqlQuery::exec() shouldn't freeze under any circumstances.