The following bug has been logged online:
Bug reference: 4162
Logged by: Javier
Email address: elpochodelagente(at)gmail(dot)com
PostgreSQL version: 8.3.1
Operating system: Windows XP SP2
Description: Hotbackup recovery doesn't work in windows
I've found that the hotbackup recovery process as described in
fails in windows.
The cause can be found in
static XLogRecord *
ReadRecord(XLogRecPtr *RecPtr, int emode);
The problem is the following: When postgres tryies to recover, it looks for
WAL files in incremental order until it reaches a file while doesn't exist.
The variable readFile is assigned a file descriptor for the next WAL file to
be recovered, which is obtained by procedure XLogReadFile. When postgres
reaches a WAL file that doesn't exist, XLogReadFile returns -1.
Now, after getting readFile value, the following code is executed:
if (readFile < 0)
label next_record_is_invalid is followed by
in POSIX version of close() it would just fail because the descriptor is
invalid. In microsoft implementation (close() included from io.h), the
application crashes (it doesn't even raise an exception, while debugging a
message appears saying "Microsoft Visual Studio C Runtime Library has
detected a fatal error in testclose.exe.").
The bug may be fixed by testing readFile before close:
if (readFile >= 0)
To reproduce bug you can try making a base backup in windows and then trying
I discovered all this by attaching to postgres.exe process at start with
visual studio 2005, the debugging symbols where invaluable. Then I tested
this minimal code just to check in a new project.
int _tmain(int argc, _TCHAR* argv)
it crashes the same way.
pgsql-bugs by date
|Next:||From: Kevin Grittner||Date: 2008-05-13 16:28:35|
|Subject: Re: Server not listening|
|Previous:||From: D Galen||Date: 2008-05-12 23:24:42|
|Subject: Server not listening|