Page 1 of 1

VPN times out when waiting for SQL queries

Posted: Wed Jul 13, 2016 3:09 am
by jrale
Hello,

We are having an issue where any SQL queries we issue to a SQL server inside our SoftEther VPN work when less than 40 seconds, but 40+ seconds will result in the following message: "A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)"

This works:
WAITFOR DELAY '00:00:39';SELECT 1;

This does not:
WAITFOR DELAY '00:00:40';SELECT 1;

Basically any query that takes longer than 39 seconds will cancel and return an error. Running the query on another server inside the VPN against the SQL server succeeds as well as if we open a port to allow a straight connection to the database from the internet so the issue definitely seems localized to the VPN. The VPN server is running on Windows Server 2012 R2 if that makes any difference. Is there some timeout setting we can adjust or something else to look for?

Re: VPN times out when waiting for SQL queries

Posted: Thu Feb 23, 2017 6:25 am
by thisjun
Are there any router or firewall or SecureNAT or localbridge between the SQL client and the SQL server?

Re: VPN times out when waiting for SQL queries

Posted: Tue Mar 07, 2017 1:55 am
by nerdamigo
I am also experiencing this issue - I'm connecting from a windows 10 machine to softether running on win 2016.

SecureNat is enabled. What other information can I provide that would help diagnose this issue?

Re: VPN times out when waiting for SQL queries

Posted: Thu Mar 16, 2017 6:40 am
by thisjun
Could you try that the SQL Server PC connect to the virtual hub and client queries with virtual IP address?

Re: VPN times out when waiting for SQL queries

Posted: Thu Mar 16, 2017 3:22 pm
by nerdamigo
What?

I have no idea what you're asking me to do - the SQL Server is in the same network as the VPN server, and the clients are connecting to the VPN server and acquiring an IP from the secure nat service.

Re: VPN times out when waiting for SQL queries

Posted: Fri Mar 17, 2017 3:50 pm
by jrale
thisjun wrote:
> Could you try that the SQL Server PC connect to the virtual hub and client
> queries with virtual IP address?

This works for me. The internal network is 10.0.0.0/24; the VPN server has an IP of 10.0.0.1 and the SQL server is 10.0.0.3. The SecureNAT on the VPN is set to 192.168.1.0/24 with the server at 192.168.1.1 and the VPN clients are issued DHCP from 192.168.1.100-192.168.1.200. When a client connects to the VPN and queries the SQL server against 10.0.0.3, it "works" except it times out for queries over 40 seconds. If I connect the SQL server to the VPN as a client and then connect to 192.168.1.101 (the DHCP address the SQL server received) from another VPN client, then I can run queries for minutes and it works perfectly fine.

So is there some setting related to SecureNAT that needs adjustment to allow connections to the normal 10.0.0.3 address to not time out when running for 40+ seconds? I really don't want to have to loop the SQL server back into it's own network and have a separate IP that VPN clients need to use instead of the normal address.

Re: VPN times out when waiting for SQL queries

Posted: Fri Nov 16, 2018 2:40 am
by trevor
Hi all,

Has anyone found a (better) solution to the timeout issue when running SQL queries that are longer than 40 seconds? We've hit the same roadblock making SoftEther unusable for our SQL devs. I'm hoping there's something we can adjust to get it working because other than this, SoftEther has been excellent.

Thanks,
Trevor

Re: VPN times out when waiting for SQL queries

Posted: Sat Nov 17, 2018 3:02 am
by ivankamart
I found this solution, you can see more here

Code: Select all

reddit.com/r/networking/comments/6hc4qm/slow_sql_queries_over_vpn/

Re: VPN times out when waiting for SQL queries

Posted: Fri Jan 18, 2019 2:30 am
by trevor
Did any of the solutions in the reddit thread work fo you? Nothing has worked for me so we had to go with another solution.

If there's a fix I'd like to go back to SoftEther.

Re: VPN times out when waiting for SQL queries

Posted: Thu Feb 21, 2019 5:49 am
by thisjun
SecureNAT has the bug about finishing TCP conection.
Please try updating to latest version.

Re: VPN times out when waiting for SQL queries

Posted: Wed Feb 27, 2019 8:22 pm
by trevor
Hi thisjun,

I updated the server and client to version 4.28 Build 9669 and still get the timeout at 40 seconds. I was hopeful this latest version would work

WAITFOR DELAY '00:00:45';SELECT 1;

Re: VPN times out when waiting for SQL queries

Posted: Fri Aug 02, 2019 6:27 am
by redog
en...I think it's hub GroupPolicy Time-out Period policy,but it's only maxtime 60s,

when i used SecureNAT the tcp timeout is 1800s

so,you can try change GroupPolicy Time-out Period = 60

if you wants most maybe change and compile src