httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: apreqXXXXXX temp files remain after processing uploads greater than 256kb. Further large upload fails
Date Sat, 31 Mar 2007 00:26:48 GMT
Steve Hay <steve.hay@uk.radan.com> writes:

> If I just apply the util.c change (i.e. drop the NOCLEANUP and
> SHARELOCK flags, but continue using perl.exe and httpd.exe for the
> upload tests) then all the tests still seem to pass anyway, but I do
> then see some stray "apreqXXXXXX" files left over in my temp directory
> from time to time 

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;
}



-- 
Joe Schaefer


Mime
View raw message