httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <>
Subject Re: apreqXXXXXX temp files remain after processing uploads greater than 256kb. Further large upload fails
Date Sun, 11 Mar 2007 21:28:06 GMT
On Sun, 11 Mar 2007, Joe Schaefer wrote:

> So I think what's happening in the cases where the
> tempfiles aren't being removed is that the call to
> apr_file_remove is failing.  On windows, let's trap
> that error in apreq_file_cleanup and call DeleteFile()
> in that case.  If that fails return APR_EGENERAL.

>From what I can see from
apr_file_remove() on Win32 is calling DeleteFile(), with
unicode issues taken into consideration. So if 
apr_file_remove() is failing, then DeleteFile() is

I've seen problems in the Perl world on Win32
unable to delete files because the file handle
is still in scope: for example,

   my $file = 'dummy.txt';
   open(my $fh, '>', $file);
   print $fh "Hello";
   unlink $file or warn $!;

works on Unix but fails on Win32 with a "permission
denied" error. The fix is to
before unlinking the file. Vinay's original patch
with the addition of apr_file_close() I thought
was doing the analagous thing (I had originally
tried this, but had been inserting it too early
in the process).

By the way, as discussed at
I tried a simple C program that just uses the
code in apreq_file_mktemp(), with the registered
apreq_file_cleanup(), to open and close a temp
file - in this case, the temp files were cleaned
up with or without the

  #ifdef WIN32

Since this problem of temp files only happens with
the Perl glue, it may be that there's some complex
interaction happening between apr and Perl.

> Also, get rid of this ifdef in apreq_file_mktemp:
> #ifdef WIN32
> #endif
> It's bogus, and IMO is only confusing the situation.

I agree, but, at least at the time it was added,
it definitely did help in the cleanup of temp
files. So it'd be nice to be able to replace
this with something more understandable.

best regards,

View raw message