Closed davepacheco closed 7 years ago
I've also marked the core files for pick-up by thoth. They should be tagged with ticket "pg_prefaulter#40".
Relevant snippet of ptree(1)
:
9218 ./pg_prefaulter run --config=pg_prefaulter-follower.toml --retry-db-init
10065 /opt/local/bin/pg_xlogdump -f /var/pgsql/go/src/github.com/joyent/pg_prefaulter
Term the follower:
$ pargs 10065
pargs: Couldn't determine locale of target process.
pargs: Some strings may not be displayed properly.
10065: /opt/local/bin/pg_xlogdump -f /var/pgsql/go/src/github.com/joyent/pg_prefaulter
argv[0]: /opt/local/bin/pg_xlogdump
argv[1]: -f
argv[2]: /var/pgsql/go/src/github.com/joyent/pg_prefaulter/.pgdata_follower/pg_xlog/000000010000000000000017
ptree(1)
reports no child processes. Watching ptree(1)
in a tight loop shows that pg_xlogdump(1)
is terminated after the expected 1s
delay.
The prefaulter spawns new pg_xlogdump(1)
commands as expected and terminates them within 1s. Tests performed under high write load (pgbench(1)
) and while PostgreSQL was idle.
We've found another case where the prefaulter implicitly hangs onto references to a database's filesystem after the database itself has shut down. This is a problem for Manatee because Manatee attempts to unmount and mount the filesystem as part of starting the database (itself a separate problem), but it can't unmount it while the prefaulter is holding these references. This is a similar problem as in #13, but a different way that it can happen.
In this case, there was only one process holding open a file on the database's dataset:
It's a pg_xlogdump process forked by the prefaulter:
It's not holding a file via its working directory:
But rather it seems to be one of its open fds:
Unfortunately we don't have the path for fd 3, but it seems almost certainly the WAL file that was given as an argument to the program:
The inode number reported by
stat
on that file matches the one thatpfiles
reported:The "-f" flag appears to block when it reaches the end of valid WAL data. And it does look like we're at the end:
There's one more file, but it has a much older mtime -- it looks like that might be a recycled file. It's not valid at all:
and
xxd
shows that file "84" ends in all zeros, which suggests it's all invalid:Offset e22000 is 14819328, just 8K behind where the pg_xlogdump process was in the pfiles output. And pg_xlogdump is in a loop sleeping from main():
which is clearly what it does when it reaches the end of the WAL file:
On timing, this process started at 16:34:11:
and was still running until we killed it well after 16:58Z. The manatee-sitter log shows that it was at 16:40 that we brought down postgres, and shortly after that that we started it again.
I have saved:
I will tar all of these up and upload them to "/thoth/stor/tickets/pg_prefaulter#40" in the JPC Manta.