From: | Reini Urban <rurban(at)x-ray(dot)at> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: rmtree() failure on Windows |
Date: | 2004-10-26 22:07:47 |
Message-ID: | 417ECAB3.6070004@x-ray.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Andrew Dunstan schrieb:
> Here is some more info. Below is a trace from dropdb. There is a loop
> around the rmdir() calls which I have set to time out at 600 seconds.
> The call eventually succeeds after around 300 seconds (I've seen this
> several times). It looks like we are the victim of some caching - the
> directory still thinks it has some of the files it has told us we have
> deleted successfully.
300 secs (!) fs timeout is really broken.
Looks more like a locking or network timeout issue.
What error codes does unlink(3) return?
Why don't you use DeletFileA() instead of unlink()?
Or even better, why don't you use this delete on close snippet instead:
HANDLE h;
h = CreateFile (win32_name, 0, FILE_SHARE_READ, &sec_none_nih,
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
if (h != INVALID_HANDLE_VALUE)
{
(void) SetFileAttributes (win32_name, (DWORD) win32_name);
BOOL res = CloseHandle (h);
//syscall_printf ("%d = CloseHandle (%p)", res, h);
if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES)
{
//syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE)
succeeded");
goto ok;
}
else
{
//syscall_printf ("CreateFile (FILE_FLAG_DELETE_ON_CLOSE) failed");
SetFileAttributes (win32_name, (DWORD) win32_name &
~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM));
}
}
}
/* Try a delete with attributes reset */
if (DeleteFile (win32_name))
{
syscall_printf ("DeleteFile after CreateFile/CloseHandle succeeded");
goto ok;
}
It should only happen a ERROR_SHARING_VIOLATION on NT systems with such
a long timeout. This is then a concurrency problem. win95 will not
return ERROR_SHARING_VIOLATION, only ERROR_ACCESS_DENIED
...
> 2004-10-26 10:31:09 [2496] WARNING: rmtree: rmdir took 274 secs/loops
> 2004-10-26 10:31:09 [2496] LOG: disconnection: session time: 0:04:34.11
> user=pgrunner database=template1 host=127.0.0.1 port=1918
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-10-26 22:44:18 | Should bgwriter log checkpoint start/end? |
Previous Message | Bruce Momjian | 2004-10-26 21:59:17 | Re: Unixware 714 pthreads |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas F.O'Connell | 2004-10-27 00:09:22 | Re: [PATCHES] [HACKERS] ARC Memory Usage analysis |
Previous Message | Andrew Dunstan | 2004-10-26 17:44:14 | Re: rmtree() failure on Windows |