Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 933840 - dev-lang/python-3.13.0_beta1_p3: 2 test failures (test_fcntl_64_bit, test_python_calls_appear_in_the_stack_if_perf_activated)
Summary: dev-lang/python-3.13.0_beta1_p3: 2 test failures (test_fcntl_64_bit, test_pyt...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks: 931888
  Show dependency tree
 
Reported: 2024-06-08 18:13 UTC by Alain Emilia Anna Zscheile
Modified: 2024-10-27 19:11 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,16.94 KB, text/plain)
2024-06-08 18:14 UTC, Alain Emilia Anna Zscheile
Details
build.log (build.log,456.46 KB, text/x-log)
2024-06-08 18:15 UTC, Alain Emilia Anna Zscheile
Details
Linux kernel config (config.gz,35.73 KB, application/gzip)
2024-06-11 18:44 UTC, Alain Emilia Anna Zscheile
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alain Emilia Anna Zscheile 2024-06-08 18:13:38 UTC
While compiling python-3.13 with PGO enabled, the following test failures happen (preventing the build to complete):

0:00:11 load avg: 5.82 [130/423] test_fcntl failed (1 error)
test_fcntl_64_bit (test.test_fcntl.TestFcntl.test_fcntl_64_bit) ... ERROR
0:00:27 load avg: 6.62 [272/423] test_perf_profiler failed (1 failure)
test_python_calls_appear_in_the_stack_if_perf_activated (test.test_perf_profiler.TestPerfProfiler.test_python_calls_appear_in_the_stack_if_perf_activated) ... skipped 'Unwinding is unreliable with frame pointers'
test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated (test.test_perf_profiler.TestPerfProfiler.test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated) ... skipped 'Unwinding is unreliable with frame pointers'
test_python_calls_appear_in_the_stack_if_perf_activated (test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated) ... FAIL
test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated (test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated) ... ok

Reproducible: Always

Steps to Reproduce:
1. unmask python_targets_python3_13 use flag in use.stable.mask
2. rebuild python-exec with python_targets_python3_13 use flag enabled
3. USE="pgo" emerge -av1 --autounmask =dev-lang/python-3.13.0_beta1_p3
  (add to package.keywords if necessary)
Actual Results:  
Test suite fails.

Expected Results:  
Build and tests should succeed.
Comment 1 Alain Emilia Anna Zscheile 2024-06-08 18:14:25 UTC
Created attachment 895410 [details]
emerge --info
Comment 2 Alain Emilia Anna Zscheile 2024-06-08 18:15:12 UTC
Created attachment 895411 [details]
build.log
Comment 3 Alain Emilia Anna Zscheile 2024-06-11 18:33:44 UTC
https://github.com/python/cpython/blob/939c201e00943c6dc2d515185168c30606ae522c/Lib/test/test_fcntl.py#L137
I found out that the fcntl failure probably stems from the fact that my linux kernel in use here doesn't have DNOTIFY.

$ gzip -cd /proc/config.gz | grep DNOT
# CONFIG_DNOTIFY is not set
Comment 4 Alain Emilia Anna Zscheile 2024-06-11 18:44:35 UTC
Created attachment 895631 [details]
Linux kernel config
Comment 5 Alain Emilia Anna Zscheile 2024-06-17 18:31:01 UTC
the same happens with =dev-lang/python-3.13.0_beta2_p5.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-18 01:47:39 UTC
Not really sure what to do about this. Do we really want to add a config check just for skipping a test w/ PGO? You'll get worse training data.
Comment 7 Alain Emilia Anna Zscheile 2024-06-18 15:32:18 UTC
The second problem (test_perf_profiler) appears much more concerning to me, because I have no clue what goes wrong (gdb and perf work properly on this machine).

But overall I think a solution could be to just skip the test if the necessary kernel options aren't set, or somehow downgrade these specific errors to warnings.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-02 10:50:12 UTC
I can reproduce the perf failure on one machine. Will look more.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-05 17:12:49 UTC
I see lots of e.g. 
75cf49ffe6c5 py::foo:/var/tmp/portage/dev-lang/python-3.13.0_rc1_p3-r1/temp/
test_python_hn7x5r7r/tmpqjgfp75u/perftest.py+0x5

but no py::bar:...
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-05 17:13:38 UTC
The test failed on a recent CPython PR: https://github.com/python/cpython/pull/123472#issuecomment-2325419902.

It's likely a kernel change or something.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-20 01:31:03 UTC
I'm poking more. Is there anything interesting about your system?
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-20 01:46:37 UTC
enabling USE="bpf libpfm lzma unwind" on dev-util/perf seems to have helped, not sure which did it?
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-20 02:12:51 UTC
Okay, so USE=unwind does it, because it makes it use libunwind, not elfutils.

The discussion at https://github.com/python/cpython/pull/112254#issuecomment-2096280126 onwards is insightful.

But all that said:
$ perf version
perf version 6.10.4

... which should have the fixes for the specific issue they mentioned.

It's not clear to me why libunwind will work for me and elfutils won't, but I already spent too much time on this for now.
Comment 14 Michael Egger 2024-10-13 23:05:54 UTC
Unfortunately enabling USE=unwind for perf is not possible on a llvm profile because the ebuilds don't consider llvm-libunwind.

[ebuild  N     ] sys-libs/libunwind-1.8.1  USE="zlib -debug -debug-frame -doc -libatomic -lzma -static-libs -test" ABI_X86="(32) (64) (-x32)" 
[ebuild   R    ] dev-util/perf-6.11  USE="unwind*" 
[blocks B      ] sys-libs/libunwind ("sys-libs/libunwind" is soft blocking sys-libs/llvm-libunwind-18.1.8)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-10-13 23:16:01 UTC
Can you file a Gentoo bug for perf please?
Comment 16 Larry the Git Cow gentoo-dev 2024-10-27 19:11:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c38348609e2ee7bd933641cf32a03965fbf7a478

commit c38348609e2ee7bd933641cf32a03965fbf7a478
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2024-10-27 19:10:43 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2024-10-27 19:11:29 +0000

    dev-lang/python: Skip test_perf_profiler because of frequent failures
    
    Bug: https://bugs.gentoo.org/933840
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-lang/python/python-3.13.0-r100.ebuild        | 2 ++
 dev-lang/python/python-3.13.0.ebuild             | 2 ++
 dev-lang/python/python-3.14.0_alpha1-r100.ebuild | 2 ++
 dev-lang/python/python-3.14.0_alpha1.ebuild      | 2 ++
 4 files changed, 8 insertions(+)