BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

Started by 德哥over 12 years ago7 messagesbugs
Jump to latest
#1德哥
digoal@126.com

The following bug has been logged on the website:

Bug reference: 8531
Logged by: digoal
Email address: digoal@126.com
PostgreSQL version: 9.3.1
Operating system: CentOS 6.4 x64
Description:

kernel:
[root@db-172-16-3-150 ~]# rpm -qa|grep debug
kernel-debuginfo-2.6.32-358.el6.x86_64
kernel-debuginfo-common-x86_64-2.6.32-358.el6.x86_64
[root@db-172-16-3-150 ~]# uname -r
2.6.32-358.el6.x86_64

Stap Ver: 2.4
[root@db-172-16-3-150 ~]# stap -V
Systemtap translator/driver (version 2.4/0.152, commit
release-2.3-133-g335e342 + changes)
Copyright (C) 2005-2013 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: LIBSQLITE3 BOOST_SHARED_PTR TR1_UNORDERED_MAP NLS JAVA

PostgreSQL : 9.3.1

When i probe checkpoint__done, and read the parameters , it's error:
[root@db-172-16-3-150 ~]# stap --vp 20000 -e 'probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $arg1)}'
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/linux/*.stpm", found: 2, processed:
2
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/*.stpm", found: 2, processed: 2
Searched: "/opt/systemtap/share/systemtap/tapset/linux/x86_64/*.stp", found:
3, processed: 3
Searched: "/opt/systemtap/share/systemtap/tapset/linux/*.stp", found: 67,
processed: 67
Searched: "/opt/systemtap/share/systemtap/tapset/x86_64/*.stp", found: 1,
processed: 1
Searched: "/opt/systemtap/share/systemtap/tapset/*.stp", found: 21,
processed: 21
Pass 1: parsed user script and 96 library script(s) using
152024virt/25252res/2128shr/23932data kb, in 230usr/20sys/253real ms.
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+40(%rip)': identifier
'$arg1' at <input>:1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $arg1)}

^
semantic error: unable to find local 'arg1', [man error::dwarf] dieoffset
0xd00f5 in /home/pg93/pgsql9.3.1/bin/postgres, near pc 0x4b9789 in
CreateCheckPoint xlog.c (alternatives: $flags $shutdown $checkPoint $recptr
$Insert $rdata $freespace $_logSegNo $vxids $nvxids $__func__): identifier
'$arg1' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $arg1)}

^

semantic error: SDT asm not understood, requires debuginfo: identifier
'$arg1' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $arg1)}

^

Pass 2: analysis failed. [man error::pass2]

Read $$vars also ERROR:
[root@db-172-16-3-150 ~]# stap --vp 20000 -e 'probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}'
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/linux/*.stpm", found: 2, processed:
2
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/*.stpm", found: 2, processed: 2
Searched: "/opt/systemtap/share/systemtap/tapset/linux/x86_64/*.stp", found:
3, processed: 3
Searched: "/opt/systemtap/share/systemtap/tapset/linux/*.stp", found: 67,
processed: 67
Searched: "/opt/systemtap/share/systemtap/tapset/x86_64/*.stp", found: 1,
processed: 1
Searched: "/opt/systemtap/share/systemtap/tapset/*.stp", found: 21,
processed: 21
Pass 1: parsed user script and 96 library script(s) using
152020virt/25252res/2128shr/23928data kb, in 230usr/10sys/253real ms.
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+40(%rip)': identifier
'$$vars' at <input>:1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^
WARNING: Can't parse SDT_V3 operand 'NBuffers(%rip)': identifier '$$vars' at
:1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+44(%rip)': identifier
'$$vars' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+48(%rip)': identifier
'$$vars' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+52(%rip)': identifier
'$$vars' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^
semantic error: unable to find local 'arg1', [man error::dwarf] dieoffset
0xd00f5 in /home/pg93/pgsql9.3.1/bin/postgres, near pc 0x4b9789 in
CreateCheckPoint xlog.c (alternatives: $flags $shutdown $checkPoint $recptr
$Insert $rdata $freespace $_logSegNo $vxids $nvxids $__func__): identifier
'$$vars' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^

semantic error: SDT asm not understood, requires debuginfo: identifier
'$$vars' at :1:94
source: probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{printf("%d\n", $$vars)}

^

Pass 2: analysis failed. [man error::pass2]

But, it's correct when not read the parameter.
[root@db-172-16-3-150 ~]# stap --vp 20000 -e 'probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done")
{println("Hello")}'
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/linux/*.stpm", found: 2, processed:
2
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/*.stpm", found: 2, processed: 2
Searched: "/opt/systemtap/share/systemtap/tapset/linux/x86_64/*.stp", found:
3, processed: 3
Searched: "/opt/systemtap/share/systemtap/tapset/linux/*.stp", found: 67,
processed: 67
Searched: "/opt/systemtap/share/systemtap/tapset/x86_64/*.stp", found: 1,
processed: 1
Searched: "/opt/systemtap/share/systemtap/tapset/*.stp", found: 21,
processed: 21
Pass 1: parsed user script and 96 library script(s) using
152020virt/25248res/2128shr/23928data kb, in 240usr/10sys/254real ms.
Hello
Hello

And , other probes is ok:
[root@db-172-16-3-150 ~]# stap --vp 20000 -e 'probe
process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__start")
{println($arg1)}'
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/linux/*.stpm", found: 2, processed:
2
Searched for library macro files:
"/opt/systemtap/share/systemtap/tapset/*.stpm", found: 2, processed: 2
Searched: "/opt/systemtap/share/systemtap/tapset/linux/x86_64/*.stp", found:
3, processed: 3
Searched: "/opt/systemtap/share/systemtap/tapset/linux/*.stp", found: 67,
processed: 67
Searched: "/opt/systemtap/share/systemtap/tapset/x86_64/*.stp", found: 1,
processed: 1
Searched: "/opt/systemtap/share/systemtap/tapset/*.stp", found: 21,
processed: 21
Pass 1: parsed user script and 96 library script(s) using
152020virt/25256res/2128shr/23928data kb, in 240usr/10sys/253real ms.
28
24

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: 德哥 (#1)
Re: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

digoal@126.com wrote:

When i probe checkpoint__done, and read the parameters , it's error:

CHECKPOINT_DONE doesn't have parameters. It works for CHECKPOINT_START
because that one has one parameter.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#3德哥
digoal@126.com
In reply to: Alvaro Herrera (#2)
Re: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

HI,

But the CHECKPOINT_DONE used in src have parameters:
CheckpointStats.ckpt_bufs_written,
NBuffers,
CheckpointStats.ckpt_segs_added,
CheckpointStats.ckpt_segs_removed,
CheckpointStats.ckpt_segs_recycled

probes.h
/* TRACE_POSTGRESQL_CHECKPOINT_DONE ( int, int, int, int, int) */
#if defined STAP_SDT_V1
#define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() __builtin_expect (checkpoint__done_semaphore, 0)
#define postgresql_checkpoint__done_semaphore checkpoint__done_semaphore
#else
#define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_checkpoint__done_semaphore, 0)
#endif
__extension__ extern unsigned short postgresql_checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
#define TRACE_POSTGRESQL_CHECKPOINT_DONE(arg1,arg2,arg3,arg4,arg5) \
DTRACE_PROBE5(postgresql,checkpoint__done,arg1,arg2,arg3,arg4,arg5)

src/backend/access/transam/xlog.c
TRACE_POSTGRESQL_CHECKPOINT_DONE(CheckpointStats.ckpt_bufs_written,
NBuffers,
CheckpointStats.ckpt_segs_added,
CheckpointStats.ckpt_segs_removed,
CheckpointStats.ckpt_segs_recycled);

and PostgreSQL Document:

| checkpoint-done | (int, int, int, int, int) | Probe that fires when a checkpoint is complete. (The probes listed next fire in sequence during checkpoint processing.) arg0 is the number of buffers written. arg1 is the total number of buffers. arg2, arg3 and arg4 contain the number of xlog file(s) added, removed and recycled respectively. |

--
公益是一辈子的事,I'm Digoal,Just Do It.

At 2013-10-17 23:47:54,"Alvaro Herrera" <alvherre@2ndquadrant.com> wrote:

Show quoted text

digoal@126.com wrote:

When i probe checkpoint__done, and read the parameters , it's error:

CHECKPOINT_DONE doesn't have parameters. It works for CHECKPOINT_START
because that one has one parameter.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: 德哥 (#3)
Re: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

digoal wrote:

But the CHECKPOINT_DONE used in src have parameters:
CheckpointStats.ckpt_bufs_written,
NBuffers,
CheckpointStats.ckpt_segs_added,
CheckpointStats.ckpt_segs_removed,
CheckpointStats.ckpt_segs_recycled

Uh, you're right. I confused it with BUFFER_CHECKPOINT_DONE.

I have no useful answer for this right now. The types of the parameters
appear correct, but that's as further as I checked.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#5德哥
digoal@126.com
In reply to: Alvaro Herrera (#2)
Re: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

HI,
I use the two method below get values from probes it.

int v1,v2,v3,v4,vnb;
vnb =NBuffers;
v1 =CheckpointStats.ckpt_bufs_written;
v2 =CheckpointStats.ckpt_segs_added;
v3 =CheckpointStats.ckpt_segs_removed;
v4 =CheckpointStats.ckpt_segs_recycled;

TRACE_POSTGRESQL_CHECKPOINT_DONE(v1,
vnb,
v2,
v3,
v4);

this method cann't output the NBuffers value.
[root@db-172-16-3-150~]# stap -D MAXSTRINGLEN=100000 --vp 10000 -e 'probe process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done") {println($$locals$$)}'
Pass 1: parsed user script and 96 library script(s) using 152048virt/25252res/2116shr/23956data kb, in 230usr/10sys/252real ms.
shutdown=? checkPoint={.redo=26648020808, .ThisTimeLineID=1, .PrevTimeLineID=1, .fullPageWrites='\001', .nextXidEpoch=0, .nextXid=130667532, .nextOid=57479, .nextMulti=1, .nextMultiOffset=0, .oldestXid=1800, .oldestXidDB=1, .oldestMulti=1, .oldestMultiDB=1, .time=1382057407, .oldestActiveXid=130667532} recptr=26648020968 Insert={.PrevRecord=26648020864, .curridx=886, .currpage=0x7f6ca01fc000, .currpos="", .RedoRecPtr=26648020808, .forcePageWrites='\000', .fullPageWrites='\001', .exclusiveBackup='\000', .nonExclusiveBackups=0, .lastBackupStart=0} rdata={.data="H?X4", .len=72, .buffer=0, .buffer_std='\001', .next=0x0} freespace=? _logSegNo=? vxids={.backendId=?, .localTransactionId=?} nvxids=0 __func__="CreateCheckPoint" v1=0 v2=0 v3=0 v4=0 vnb=?

the second method:
[root@db-172-16-3-150~]# stap -D MAXSTRINGLEN=100000 --vp 10000 -e '
probe process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done") {
printf("ckpt_bufs_written:%d, ckpt_segs_added:%d, ckpt_segs_removed:%d, ckpt_segs_recycled:%d, NBuffers:%d\n", @var("CheckpointStats")->ckpt_bufs_written, @var("CheckpointStats")->ckpt_segs_added, @var("CheckpointStats")->ckpt_segs_removed, @var("CheckpointStats")->ckpt_segs_recycled, @var("NBuffers"))
}'
Pass 1: parsed user script and 96 library script(s) using 151984virt/25256res/2116shr/23892data kb, in 240usr/20sys/251real ms.
ckpt_bufs_written:0, ckpt_segs_added:0, ckpt_segs_removed:0, ckpt_segs_recycled:0, NBuffers:262144
ckpt_bufs_written:0, ckpt_segs_added:0, ckpt_segs_removed:0, ckpt_segs_recycled:0, NBuffers:262144

--
公益是一辈子的事,I'm Digoal,Just Do It.

At 2013-10-17 23:47:54,"Alvaro Herrera" <alvherre@2ndquadrant.com> wrote:

Show quoted text

digoal@126.com wrote:

When i probe checkpoint__done, and read the parameters , it's error:

CHECKPOINT_DONE doesn't have parameters. It works for CHECKPOINT_START
because that one has one parameter.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#4)
Re: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

Alvaro Herrera <alvherre@2ndquadrant.com> writes:

digoal wrote:

But the CHECKPOINT_DONE used in src have parameters:
CheckpointStats.ckpt_bufs_written,
NBuffers,
CheckpointStats.ckpt_segs_added,
CheckpointStats.ckpt_segs_removed,
CheckpointStats.ckpt_segs_recycled

Uh, you're right. I confused it with BUFFER_CHECKPOINT_DONE.

I have no useful answer for this right now. The types of the parameters
appear correct, but that's as further as I checked.

FWIW, I'd guess this is a bug in systemtap, and accordingly should be
reported to those folk. Try filing at bugzilla.redhat.com ... although
they might tell you to try a supported systemtap release, which yours
isn't AFAICT. What I see on my RHEL6 box is systemtap-1.8-7.el6.x86_64
and stap -V sez

Systemtap translator/driver (version 1.8/0.152 non-git sources)
Copyright (C) 2005-2012 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS TR1_UNORDERED_MAP NLS

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#7德哥
digoal@126.com
In reply to: Tom Lane (#6)
Re: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters

HI,
Thanks tom lane.
The stap 2.4 version has same problem, I need use @var("varname") get the value instead $argN.

[root@db-172-16-3-150 ~]# stap -V
Systemtap translator/driver (version 2.4/0.152, commit release-2.3-133-g335e342 + changes)
Copyright (C) 2005-2013 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: LIBSQLITE3 BOOST_SHARED_PTR TR1_UNORDERED_MAP NLS JAVA
[root@db-172-16-3-150 ~]# which stap
/opt/systemtap/bin/stap
[root@db-172-16-3-150 ~]# stap --vp 11111 -e '

probe process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done") {
println($$vars)
exit()
}'

Pass 1: parsed user script and 96 library script(s) using 152024virt/25212res/2104shr/23932data kb, in 240usr/10sys/253real ms.
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+40(%rip)': identifier '$$vars' at <input>:3:11
source: println($$vars)
^
WARNING: Can't parse SDT_V3 operand 'NBuffers(%rip)': identifier '$$vars' at :3:11
source: println($$vars)
^
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+44(%rip)': identifier '$$vars' at :3:11
source: println($$vars)
^
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+48(%rip)': identifier '$$vars' at :3:11
source: println($$vars)
^
WARNING: Can't parse SDT_V3 operand 'CheckpointStats+52(%rip)': identifier '$$vars' at :3:11
source: println($$vars)
^
semantic error: unable to find local 'arg1', [man error::dwarf] dieoffset 0xd00f5 in /home/pg93/pgsql9.3.1/bin/postgres, near pc 0x4b9789 in CreateCheckPoint xlog.c (alternatives: $flags $shutdown $checkPoint $recptr $Insert $rdata $freespace $_logSegNo $vxids $nvxids $__func__): identifier '$$vars' at :3:11
source: println($$vars)
^

semantic error: SDT asm not understood, requires debuginfo: identifier '$$vars' at :3:11
source: println($$vars)
^

Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) using 176172virt/32892res/5620shr/27852data kb, in 30usr/10sys/151real ms.
Pass 2: analysis failed. [man error::pass2]

Use @var("varname") can get the value correct.
[root@db-172-16-3-150 ~]# stap --vp 11111 -e '
probe process("/home/pg93/pgsql9.3.1/bin/postgres").mark("checkpoint__done") {
println(@var("NBuffers"))
exit()
}'
Pass 1: parsed user script and 96 library script(s) using 152024virt/25212res/2104shr/23932data kb, in 240usr/20sys/254real ms.
Pass 2: analyzed script: 1 probe(s), 2 function(s), 0 embed(s), 0 global(s) using 175644virt/32208res/5524shr/27324data kb, in 30usr/0sys/36real ms.
Pass 3: translated to C into "/tmp/stap9yW3g4/stap_4e8bb94e54f595ef6f3e48aed9859200_1792_src.c" using 303812virt/32556res/5872shr/27324data kb, in 20usr/100sys/109real ms.
Pass 4: compiled C into "stap_4e8bb94e54f595ef6f3e48aed9859200_1792.ko" in 2290usr/410sys/2699real ms.
Pass 5: starting run.
2621440
Pass 5: run completed in 0usr/30sys/11089real ms.

--
公益是一辈子的事,I'm Digoal,Just Do It.

At 2013-11-11 05:54:50,"Tom Lane" <tgl@sss.pgh.pa.us> wrote:

Show quoted text

Alvaro Herrera <alvherre@2ndquadrant.com> writes:

digoal wrote:

But the CHECKPOINT_DONE used in src have parameters:
CheckpointStats.ckpt_bufs_written,
NBuffers,
CheckpointStats.ckpt_segs_added,
CheckpointStats.ckpt_segs_removed,
CheckpointStats.ckpt_segs_recycled

Uh, you're right. I confused it with BUFFER_CHECKPOINT_DONE.

I have no useful answer for this right now. The types of the parameters
appear correct, but that's as further as I checked.

FWIW, I'd guess this is a bug in systemtap, and accordingly should be
reported to those folk. Try filing at bugzilla.redhat.com ... although
they might tell you to try a supported systemtap release, which yours
isn't AFAICT. What I see on my RHEL6 box is systemtap-1.8-7.el6.x86_64
and stap -V sez

Systemtap translator/driver (version 1.8/0.152 non-git sources)
Copyright (C) 2005-2012 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS TR1_UNORDERED_MAP NLS

regards, tom lane