The QGIS Cloud Support team regularly receives inquiries describing errors when uploading data to the database from the QGIS Cloud plugin. In this short blog article, I would like to explain the cause of this problem and provide some tips for analysis.
Imagine you have just created a QGIS Cloud account and your first beautiful project with data is ready. Now you want to publish the project. It’s very simple:
-
All data layers are listed in the “Load data” tab.
-
Click on “Upload data.”
Unfortunately, this is where the big disappointment comes. The upload aborts with the error message
SSL connection has been closed unexpectedly.
What is the cause?
To understand the error, we need to know how the QGIS Cloud plugin and the QGIS Cloud database cluster communicate with each other. The QGIS Cloud plugin wants to connect to the QGIS Cloud database via port 5432. Port 5432 is the standard port used to communicate with PostgreSQL databases. However, this port is often closed by firewalls. In this case, the QGIS Cloud plugin cannot establish a connection to the database, which leads to the error mentioned above.
Another source of error is an unstable or very slow network connection. This can also cause this error.
I would like to present a procedure for checking both cases, which will allow us to determine which of the two factors is causing the problem in each case.
Port 5432 is closed.
Windows:
Open PowerShell and run the following command:
Test-NetConnection -ComputerName db.qgiscloud.com -Port 5432.
If port 5432 is open, the output will look like this:
ComputerName : db.qgiscloud.com
RemoteAddress : 136.243.87.197
RemotePort : 5432
InterfaceAlias: Ethernet
Source: xxx.xxx.xxx.xxx
TcpTestSucceeded: True
If the port is closed, we see:
TcpTestSucceeded: False.
Now port 5432 must be opened in the firewall and the connection to the database cluster can be established.
Linux
Open the Linux terminal with Ctrl+Alt+T and enter this command:
telnet db.qgiscloud.com 5432
If the port is open and the QGIS Cloud database cluster is accessible, the response will look like this:
Trying 136.243.87.197...
Connected to db.qgiscloud.com.
If the port is closed, we will only see
Trying 136.243.87.197...
Here, too, the solution is to open port 5432 in the firewall.
Weak or unstable Internet connection
Windows and Linux
For this check, we again need Windows Power Shell or the Linux terminal. Enter the command to check the network connection:
ping db.qgiscloud.com
The output should look something like this:
Pinging db.qgiscloud.com [136.243.87.197] with 32 bytes of data:
Reply from 136.243.87.197: bytes=32 time=331ms TTL=49
Reply from 136.243.87.197: bytes=32 time=335ms TTL=49
Reply from 136.243.87.197: bytes=32 time=292ms TTL=49
Reply from 136.243.87.197: bytes=32 time=292ms TTL=49
Ping statistics for 136.243.87.197:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 292ms, Maximum = 335ms, Average = 312ms
The statistics show whether the connection is stable:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
In this example, we have a stable connection with 0% loss
, which is good.
In addition, the
Approximate round trip times in milliseconds:
should be at least 500ms
.