Bug 2152970 - Disbalance in function__entry and function__return marker hits
Summary: Disbalance in function__entry and function__return marker hits
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.11
Version: 38
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Python Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-13 16:21 UTC by Martin Cermak
Modified: 2024-05-21 14:22 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-05-21 14:22:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github python cpython issues 104280 0 None open Missing DTrace probes 2023-10-17 09:13:51 UTC

Description Martin Cermak 2022-12-13 16:21:32 UTC
I'm noticing a disbalance in function__entry and function__return static marker hits.  Python comes with systemtap static markers as described in [1]. The following is a demonstration how the function__return marker is hit, while the respective function__entry marker is not.  Let's have a simple python script:

$ cat test.py 
import random
print(random.random())
$ 

The following is a demonstration how certain function__return markers are hit:

$ cat gdb.cmds 
# run program so that all .SO's load and so do the static markers
r
# list avail static markers
info probes stap python
# print the 1st marker argument (filename) each time the static marker is hit:
b -probe-stap function__return
commands 1
p (char*)$_probe_arg0
c
end
r
$ gdb --command=gdb.cmds --batch --args python3 ./test.py | grep -F random
$2944 = 0x7ffff74e9780 "/usr/lib64/python3.11/random.py"
$2945 = 0x7ffff74e9780 "/usr/lib64/python3.11/random.py"
$2946 = 0x7ffff74e9780 "/usr/lib64/python3.11/random.py"
$2947 = 0x7ffff74e9780 "/usr/lib64/python3.11/random.py"
$2948 = 0x7ffff74e9780 "/usr/lib64/python3.11/random.py"
$2949 = 0x7ffff74e9780 "/usr/lib64/python3.11/random.py"
$ 

Now let's modify our gdb.cmds file so that function__entry markers are being monitored instead of function__return markers:

$ cat gdb.cmds 
# run program so that all .SO's load and so do the static markers
r
# list avail static markers
info probes stap python
# print the 1st marker argument (filename) each time the static marker is hit:
b -probe-stap function__entry
commands 1
p (char*)$_probe_arg0
c
end
r
$ gdb --command=gdb.cmds --batch --args python3 ./test.py | grep -F random
$ 


No hit at all.  That said, if the function return marker is hit, the respective entry marker should be hit as well.  So this is the reported disbalance.  Please investigate.  Also note that with python2.7-2.7.18-27.fc38.x86_64 there is no disbalance. 

The reported problem happens with python3-3.11.1-1.fc38.x86_64 and gdb-12.1-9.fc38.x86_64.  It can also be observed using systemtap instead of gdb, as shown in [2].

------------
[1] https://github.com/python/cpython/blob/main/Doc/howto/instrumentation.rst
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=29832

Comment 2 Ben Cotton 2023-02-07 15:09:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 3 Martin Cermak 2023-03-21 07:53:00 UTC
A new bz2177062 appears to be a dupe of this one.

Comment 4 Petr Viktorin (pviktori) 2023-10-17 07:48:30 UTC
This is an upstream issue. As Python is optimized (function calls are inlined, or at least some of the setup/teardown is skipped), the systemtap markers are being left behind :(

Comment 6 Aoife Moloney 2024-05-07 15:53:28 UTC
This message is a reminder that Fedora Linux 38 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 38 on 2024-05-21.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '38'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 38 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 7 Aoife Moloney 2024-05-21 14:22:43 UTC
Fedora Linux 38 entered end-of-life (EOL) status on 2024-05-21.

Fedora Linux 38 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.