BUG #15207: In crash recovery,SyncDataDirectory() will fall into recursion trap - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15207: In crash recovery,SyncDataDirectory() will fall into recursion trap
Date
Msg-id 152706182839.26748.2392292684934019090@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #15207: In crash recovery, SyncDataDirectory() will fall into recursion trap  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15207
Logged by:          bret shao
Email address:      bret.shao@outlook.com
PostgreSQL version: 9.5.7
Operating system:   windows 10
Description:

Hi,

I'm R&D engineer of HighGo Co. Ltd.

i run the test case as below.
I install the PG at location "D:\highgo\database\", then i create a table
space with "create tablespace spacetest location 'D:\highgo\database\'"
then make the PG crash.
In crash recovery,  SyncDataDirectory() will be called in function
StartupXLOG(), in this function will call walkdir() to fsync the dir and its
contents.
Because of that the table space spacetest is point to data dir of PG, here
is 'D:\highgo\database\', 
so function walkdir will fall into recursion trap due to lstat is defined to
stat in windows environment when the pg_tblspc is handled.
Due to windows restrict the length of filename to 255, so the recursion will
terminate when the length of file name reach 255. 

Although, this issue will not affect the startup of PG but i think this
issue should be considered to fix.


the logs are showed as below.
2018-05-23 09:39:46 HKTLOG:  58P01: could not stat file

"./pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/hgdb_log/postgresql-2018-05-23_082809.log":
No such file or directory
2018-05-23 09:39:46 HKTLOG:  58P01: could not stat file 
.........
2018-05-23 09:43:24 HKTLOG:  58P01: could not stat file

"pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_tblspc/16384/pg_xlog/archive_status":
No such file or directory
2018-05-23 09:43:25 HKTLOG:  00000: database system was not properly shut
down; automatic recovery in progress
2018-05-23 09:43:25 HKTLOG:  00000: invalid record length at 0/1743418
2018-05-23 09:43:25 HKTLOG:  00000: redo is not required
2018-05-23 09:43:25 HKTLOG:  00000: MultiXact member wraparound protections
are now enabled
2018-05-23 09:43:25 HKTLOG:  00000: database system is ready to accept
connections
2018-05-23 09:43:25 HKTLOG:  00000: autovacuum launcher started


thanks.
Br.
Bret


pgsql-bugs by date:

Previous
From: "158306855"
Date:
Subject: Re: [BUG] Re-entering malloc problem when use --enable-nlsbuildpostgresql
Next
From: Tom Lane
Date:
Subject: Re: BUG #15207: In crash recovery, SyncDataDirectory() will fall into recursion trap