pg /c database 通过。似乎是pg使用 open/write 写入了某个文件,通过 fopen/fscanf 绕过了hook路径导致的。出现了新的段错误。
This commit is contained in:
47
scripts/do_trace.md
Normal file
47
scripts/do_trace.md
Normal file
@@ -0,0 +1,47 @@
|
||||
```shell
|
||||
pm=$(pgrep -u postgres -xo postgres)
|
||||
sudo strace -ff -f -yy -s 256 \
|
||||
-e trace=%file,read,pread64,readv \
|
||||
-p "$pm" -o /tmp/pg.sys.trace
|
||||
|
||||
|
||||
strace: Process 233035 attached
|
||||
strace: Process 235357 attached
|
||||
^Cstrace: Process 233035 detached
|
||||
|
||||
|
||||
fatal_pid=$(grep 'FATAL: "pg_tblspc' /tmp/pg.log | tail -1 | sed -n 's/.*\[\([0-9]\+\)\].*/\1/p'); echo "fatal_pid=$fatal_pid"
|
||||
|
||||
fatal_pid=235357
|
||||
|
||||
|
||||
grep -n "PG_VERSION\|pg_tblspc/16384/PG_12_201909212/16385" /tmp/pg.sys.trace.$fatal_pid
|
||||
|
||||
18:access("pg_tblspc/16384/PG_12_201909212/16385", F_OK) = 0
|
||||
19:openat(AT_FDCWD, "pg_tblspc/16384/PG_12_201909212/16385/PG_VERSION", O_RDONLY) = 4</zvfs/pg_ts_bench/PG_12_201909212/16385/PG_VERSION>
|
||||
20:read(4</zvfs/pg_ts_bench/PG_12_201909212/16385/PG_VERSION>, "\0\0\0", 4096) = 3
|
||||
21:read(4</zvfs/pg_ts_bench/PG_12_201909212/16385/PG_VERSION>, "", 4096) = 0
|
||||
|
||||
|
||||
|
||||
fatal_pid=$(grep 'FATAL: "pg_tblspc' /tmp/pg.log | tail -1 | sed -n 's/.*\[\([0-9]\+\)\].*/\1/p'); echo "fatal_pid=$fatal_pid"
|
||||
|
||||
grep -n "\[zvfs\]\[rw-dbg\].*pid=${fatal_pid}" /tmp/pg.log | tail -n 120
|
||||
|
||||
6461:[zvfs][rw-dbg][pid=235357][tid=140193133607488][fd=4] read passthrough reason=fd_not_zvfs count=512
|
||||
6462:[zvfs][rw-dbg][pid=235357][tid=140193133607488][fd=4] read passthrough ret=512 errno=0(OK)
|
||||
```
|
||||
|
||||
|
||||
```shell
|
||||
sudo strace -ff -f -k -yy -s 256 -e trace=openat,read,pread64 -p "$pm" -o /tmp/pg.ktrace
|
||||
```
|
||||
|
||||
调用链:
|
||||
|
||||
libc(__open64) -> _IO_file_open -> fopen -> AllocateFile -> ValidatePgVersion
|
||||
|
||||
是fopen,内部调用 libc_(__open64)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user