On Fri, 30 Mar 2007, Joe Schaefer wrote:
I still believe the problem stems from mixing posix and win32 calls;
but it's perl that mixes them, not apr. In any case, we have evidence
that our cleanup is failing, so we should include code that traps the
error and tries to recover somehow.
How about leaving the current upload.t tests alone, so they can
generate tempfiles on Steve's box, and coming up with some cleanup
code that, at least while we're trying to sort this out, does
something like this:
static apr_status_t apreq_file_cleanup(void *d)
{
struct cleanup_data *data = d;
apr_status_t s = apr_file_remove(data->fname, data->pool);
#ifdef WIN32
if (s != APR_SUCCESS) {
apr_file_t *stderr;
apr_pool_t *p;
const char fmt[] = "apr_file_remove failed with status %d on temp file %s.
"
"Sleeping for 1 sec before retrying";
apr_pool_create_ex(&p, NULL, NULL, NULL);
apr_file_open_stderr(&stderr, p);
apr_file_printf(stderr, fmt, s, data->fname);
sleep(1); /* may need to #include <unistd.h> */
apr_pool_clear(p);
apr_pool_destroy(p);
s = apr_file_remove(data->fname, data->pool);
}
#endif
return s;
}
I've tried this just using the sleep() - the printf stuff
doesn't work on Win32. Unfortunately, I still see some
apreqXXXXXX left over in the temp directory, very
occasionally (this is with perl-5.8.8, Apache/2.2.2,
mp2 2.000003). I tried a sleep(5), but that didn't
help either.
Sometimes, although it's not precisely
correlated, an entry in the error log appears:
$param->upload_tempname($req): can't make spool bucket
at ...lib/APR/Request/Param.pm
which comes from upload_tempname() in
APR/Request/Param/Param.xs, which indicates that
apreq_brigade_concat() has failed. However, sometimes
a stray temp file remains without this error, and
sometimes this error appears without a stray temp
file remaining, so I'm not sure they're directly related.
It's a frustrating problem - there doesn't seem to be
much of a pattern; I can run the tests over and over
again for 15 minutes without seeing any strays, but
at other times they appear every few minutes. This machine
isn't overly busy. The only common thing is that all of
the temp files for me are copies of the perl.exe
used in the upload test, and they're identical copies
to the original.
--
best regards,
Randy