3liz / qgis-wfsOutputExtension

QGIS Server plugin to add Output Formats to WFS GetFeature request.
9 stars 6 forks source link

On Win32: temporary files attempted to be removed before process completed, causing 'The process cannot access the file because it is being used by another process' error #68

Open rdewit opened 1 year ago

rdewit commented 1 year ago

Description

On Windows Server 2019, the current version (v1.7.1) causes the data in the requested output format to have 0 bytes and have errors in the server log.

Context

It appears that the plugin tries to remove the temporary files before the process is completed. This results in the following error: The process cannot access the file because it is being used by another process.

The problem goes away when the env var DEBUG_WFSOUTPUTEXTENSION is set to 1 but this is undesirable in the long term as temporary files would never be removed.

We run QGIS Server as FastCGI on IIS.

A more complete log output:

15:06:15 INFO WfsOutputExtension[8448]: WFS request to get format CSV
15:06:15 INFO WfsOutputExtension[8448]: Fetching XSD : HTTP code 200, request ?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=Features_of_Interest_-_Polygons&OUTPUT=XMLSCHEMA
15:06:15 INFO WfsOutputExtension[8448]: xsd_for_layer ran in 0.0s
15:06:15 INFO WfsOutputExtension[8448]: Temporary GML file is C:\Windows\Temp\QGIS_WfsOutputExtension\gml_features_1684299974.5488436.gml|option:FORCE_SRS_DETECTION=YES
15:06:15 INFO WfsOutputExtension[8448]: Temporary csv file is C:/Windows/Temp/QGIS_WfsOutputExtension/to-csv-VkLONr.csv
15:06:15 INFO WfsOutputExtension[8448]: Sending the output file
15:06:15 INFO WfsOutputExtension[8448]: send_output_file ran in 0.17s
15:06:15 WARNING [8448]: Cannot send error after headers written
15:06:15 CRITICAL Server[8448]: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Windows\\Temp\\QGIS_WfsOutputExtension\\gml_features_1684299974.5488436.gml'