Re: apreqXXXXXX temp files remain after processing uploads greater than 256kb. Further large upload fails
Joe Schaefer <[email protected]>
| Newsgroups | gmane.comp.apache.apreq |
|---|---|
| Message-ID | <[email protected]> |
Joe Schaefer <[email protected]> writes: > Randy Kobes <[email protected]> writes: > > [...] > >> apr_file_remove() on Win32 is calling DeleteFile(), with >> unicode issues taken into consideration. So if apr_file_remove() is >> failing, then DeleteFile() is failing. > > Ah yes, you are right. I thought apr was defaulting > to the unix version, which calls unlink(), but I see > I'm mistaken. > > Ok, lets presume DeleteFile() is failing, and passing > that error along to apr_file_remove(). In apreq_file_cleaup > let's then try what cygwin does in its unlink implementation: > opening the file again (using the apr API) with the APR_DELONCLOSE > flag set, then immediately closing it. Here's a different suggestion to try: Index: library/util.c =================================================================== --- library/util.c (revision 517052) +++ library/util.c (working copy) @@ -816,10 +816,6 @@ return rc; data = apr_palloc(pool, sizeof *data); - /* cleanups are LIFO, so this one will run just after - the cleanup set by mktemp */ - apr_pool_cleanup_register(pool, data, - apreq_file_cleanup, apreq_file_cleanup); /* NO APR_DELONCLOSE! see comment above */ flag = APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_BINARY; @@ -828,10 +824,11 @@ * a grep through the httpd sources seems to indicate * it's only used in sdbm files?? */ -#ifdef WIN32 - flag |= APR_FILE_NOCLEANUP | APR_SHARELOCK; -#endif rc = apr_file_mktemp(fp, tmpl, flag, pool); + /* cleanups are LIFO, so this one will run just before + the cleanup set by mktemp */ + apr_pool_cleanup_register(pool, data, + apreq_file_cleanup, apreq_file_cleanup); if (rc == APR_SUCCESS) { apr_file_name_get(&data->fname, *fp); In other words, delete the file *before* closing it. -- Joe Schaefer