BUG #15207: In crash recovery, SyncDataDirectory() will fall into recursion trap

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: bret(dot)shao(at)outlook(dot)com
Subject: BUG #15207: In crash recovery, SyncDataDirectory() will fall into recursion trap
Date: 2018-05-23 07:50:28
Message-ID: 152706182839.26748.2392292684934019090@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15207
Logged by: bret shao
Email address: bret(dot)shao(at)outlook(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-05-23 13:36:33 Re: BUG #15207: In crash recovery, SyncDataDirectory() will fall into recursion trap
Previous Message 158306855 2018-05-23 05:15:12 Re: [BUG] Re-entering malloc problem when use --enable-nlsbuildpostgresql