Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#705 closed defect (fixed)

MapGuide does not clean up temporary files

Reported by: ksgeograf Owned by:
Priority: medium Milestone:
Component: General Version: 2.0.1
Severity: trivial Keywords: temporary files C:\windows\temp
Cc: External ID: 773592

Description

When running MapGuide, there seems to be quite a lot of temporary files left in the C:\windows\temp folder.

All the files have the format "7c116e96-0000-1000-8000-005056c00008". Where the 1. and second component are either "0000-1000" or "ffff-ffff".

On my system I have 77658 of those, so clearly these get left behind during normal operation, and not just on service restarts.

Change History (12)

comment:1 by zspitzer, 16 years ago

Looking into the file, this might be fusion related

comment:2 by ksgeograf, 16 years ago

I have tried to open some of the files, and it appears to be everything I have ever sent to the server (probably everything thorugh the Web interface?). I have found runtime layer data, mapdefinitions and even an MGP package.

comment:3 by tomfukushima, 16 years ago

Hi Kenneth, So to reproduce this, we only have to start up Maestro, connect to the server, and create a resource such as a feature source, layer definition, map definitiion etc.? Thanks, Tom

comment:4 by zspitzer, 16 years ago

The are also a lot of IDFxxx.tmp files being created there which are open by the mgserver process. These files are usally 34mb also often extremely fragmented, ie 4k fragments

comment:5 by ksgeograf, 16 years ago

I just experimented, and this problem is reproduceable:

  1. Delete all files from C:\Windows\temp
  2. Open Maestro
  3. Open a resource (eg. Map).
  4. Save the resource

A new file appears in C:\windows\temp

To make sure the problem isn't Maestro, I just tried this with Studio, and it has the same behavior. I tried monitoring the mgserver.exe process, and it does not appear to have a handle to any of the created files, so the problem is most likely in the web tier.

I have none of the IDFxxx.tmp files in C:\Windows\temp.

comment:6 by waltweltonlair, 16 years ago

The problem occurs in the web tier in two places: MapAgentCommon::PopulateData and CgiPostParser::Parse. Whenever we get a multipart/form-data post request we scan for a "filename=" parameter. If found we save the content to a temporary file, and use the temporary file name as the content's value. Then when the code contacts the server with the request it reloads the data from the temporary file. But..., once everything is done these temporary files are never deleted.

There's a TODO comment in MapAgentCommon::PopulateData and CgiPostParser::Parse about changing the infrastructure so that the content's data can be directly passed in, rather than using the temporary file. Making this change is the way to fix this.

I must say it's very annoying when all these temp files get left behind.

comment:7 by trevorwekel, 16 years ago

Temporary files of the form '{mgsessionid}' are created from HTTP SetResource, SetResourceContent, SetResourceData, CreateRepository, and ApplyResourcePackage. Temporary files of the from 'sess_{mgsessionid}' are PHP sessions created by the fusion viewer. And temporary files of the form 'sess_{random string)' are PHP sessions generated from the site administrator.

comment:8 by waltweltonlair, 16 years ago

Priority: lowmedium

Partially fixed with trunk stream submission https://trac.osgeo.org/mapguide/changeset/3708.

Temporary files of the form '{mgsessionid}' will no longer get left behind as part of HTTP SetResource, SetResourceData, UpdateRepository, CreateRepository, and ApplyResourcePackage requests.

comment:9 by waltweltonlair, 16 years ago

The PHP sessions are created when using fusion or the site administrator. PHP, however, manages their lifetime. So when these get left behind it's something to do with PHP.

comment:10 by waltweltonlair, 16 years ago

Resolution: fixed
Status: newclosed

I think this has been addressed satisfactorily.

comment:11 by waltweltonlair, 16 years ago

Additional fix with trunk submission https://trac.osgeo.org/mapguide/changeset/3711.

comment:12 by waltweltonlair, 15 years ago

External ID: 773592
Note: See TracTickets for help on using tickets.