Open Gpetrak opened 3 weeks ago
I suspect this is still related to the multiple replies without clear predictability. Sometimes they seem related to the time it takes for a request to complete, sometimes related to the clearing of the cache, but it looks confirmed that it doesn't depend on the plugin.
In the case of WFS loading, the style request is performed within the same tasks as the WFS request itself. This might break the logic that pairs the request to the first reply. Maybe here we're handling the first reply for the WFS request but not the one for the style.
Let's investigate and handle this case too.
@giohappy finally, I fixed the error: Unable to load layer <some layer>: None
. The main problem was that in the current implementation two requests (one the SLD and one for the dataset) were executing from the same task.
Thus, even if WFS worked, after deleting the cache (which causes multiple replies in each request by QGIS) the request of SLD worked but, the request of Dataset didn't return any reply (maybe due to a timeout error).
So, I separated the requests to be executed by two different tasks: One for the SLD and one for the Dataset while the request of SLD starts only when the Dataset task is completed.
After this modification, the error fixed and it works even with multiple replies (after deleting the cache).
I have created a new branch (ISSUE_281) and I will create a PR after fixing the second reported error (the one that QGIS crashes when trying to load an SLD with encoding issues).
cool @Gpetrak. do you already have a PR?
@giohappy I have pushed the fixes in the branch: ISSUE_281. I didn't create yet the PR since I want to solve also the second error that is reported in this issue: the one with QGIS crash after loading a layer with an SLD which includes non-english characters (e.g greek characters). Obviously is an encoding issue. The crash happens in this line: https://github.com/GeoNode/QGISGeoNodePlugin/blob/main/src/qgis_geonode/styles.py#L49 I'm searching for an elegant way to decode the Stream object before the save() method.
@giohappy for the sake of clearness, I think that it is better to open a new ssue for the QGIS crash because it is a completely different error. Thus, I can create the PR for the main issue that we investigated.
ok @Gpetrak please proceed.
When a user tries to load a layer through the WFS, sometimes the plugin raises the following error:
Sometimes before crashing QGIS exports the following error:
which comes from the
handle_layer_detail
function of the file: seach_result_widget.py, line 250.It’s worth noting that both WFS versions (1.1.0, 2.0.0) were used. Also the WCS seems to work without a crash (tested with the live demo of GeoNode).