Opened 13 years ago

Last modified 13 years ago

#3643 new defect

Temporary file for SLD external graphic is not deleted

Reported by: matthijsln Owned by: mapserverbugs
Priority: low Milestone: FUTURE
Component: WMS Server Version: svn-trunk (development)
Severity: minor Keywords: sld temporary file external graphic
Cc:

Description

When using an ExternalGraphic in a SLD symbolizer, a temporary .gif or .png file is created with msTmpFile() in msSLDParseExternalGraphic() in mapogcsld.c. After the external image is saved to the temporary file using msHTTPGetFile(), it is never deleted.

In my case this led to a build-up of thousands of temporary files after many WMS requests.

#1123 is similar but concerning the SLD itself.

The solution would be to add the line

unlink(pszTmpSymbolName);

after the call to msSLDGetGraphicSymbol() in the function msSLDParseExternalGraphic() in mapogcsld.c.

Another very minor issue is that the filename allocated by msTmpFile() is not msFree()'d. This also occurs in other places where msTmpFile() is used.

Steps to reproduce:

  1. save extgraphicsld.map to /tmp/
  2. save extgraphicsld.xml to /var/www/
  3. open the following url:

http://localhost/cgi-bin/mapserv?map=/tmp/extgraphicsld.map&sld=http://localhost/extgraphicsld.xml&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=460&HEIGHT=348&LAYERS=mylayer&TRANSPARENT=TRUE&FORMAT=image/png&BBOX=132795.0476944507,454569.63632023387,133976.6444011738,455463.5399157548&SRS=EPSG:28992&STYLES=

  1. observe a temporary gif file in /tmp remaining after each request

Attachments (2)

extgraphicsld.map (664 bytes ) - added by matthijsln 13 years ago.
extgraphicsld.xml (635 bytes ) - added by matthijsln 13 years ago.

Download all attachments as: .zip

Change History (3)

by matthijsln, 13 years ago

Attachment: extgraphicsld.map added

by matthijsln, 13 years ago

Attachment: extgraphicsld.xml added

comment:1 by assefa, 13 years ago

Milestone: FUTURE

Inthe sld code, the filename is set in the symbol property. The file is loaded and used layer on when the symbol is drawn. Unlinking/deleting the file in the sld code would break the drawing. As for tmp management we have a better tmp directory management (http://mapserver.org/development/rfc/ms-rfc-66.html) that can ease up the management of temporary files. Maybe a flag that indicate that the file is temporary would be the utlimate solution.

Pushing it to future

Note: See TracTickets for help on using tickets.