classification
Title: test_gdb failed on AMD64 Debian PGO 3.x
Type: Stage: resolved
Components: Tests Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: steve.dower, vstinner
Priority: normal Keywords: patch

Created on 2019-05-23 17:16 by vstinner, last changed 2019-05-24 20:00 by steve.dower. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13555 merged steve.dower, 2019-05-24 17:53
Messages (8)
msg343314 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-23 17:16
It's likely a regression caused by bpo-36842.

https://buildbot.python.org/all/#/builders/47/builds/2854

Example of failure:

======================================================================
FAIL: test_NULL_ob_type (test.test_gdb.PrettyPrintTests)
Ensure that a PyObject* with NULL ob_type is handled gracefully
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/buildbot/slaves/enable-optimizations-bot/3.x.gps-debian-profile-opt.nondebug/build/Lib/test/test_gdb.py", line 533, in test_NULL_ob_type
    self.assertSane('id(42)',
  File "/var/lib/buildbot/slaves/enable-optimizations-bot/3.x.gps-debian-profile-opt.nondebug/build/Lib/test/test_gdb.py", line 504, in assertSane
    self.get_gdb_repr(source,
  File "/var/lib/buildbot/slaves/enable-optimizations-bot/3.x.gps-debian-profile-opt.nondebug/build/Lib/test/test_gdb.py", line 278, in get_gdb_repr
    self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))
AssertionError: Unexpected gdb output: 'Breakpoint 1 at 0x201df0: file Python/bltinmodule.c, line 1217.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".\n\nBreakpoint 1, builtin_id () at Python/bltinmodule.c:1217\n1217\t{\n#0  builtin_id () at Python/bltinmodule.c:1217\n#1  _PyMethodDef_RawFastCallKeywords () at Objects/call.c:650\n#2  _PyCFunction_FastCallKeywords (func=<built-in method id of module object at remote 0x7ffff6ea7180>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Objects/call.c:736\n#3  call_function (kwnames=0x0, oparg=1, pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:4831\n#4  _PyEval_EvalFrameDefault () at Python/ceval.c:3347\n#5  PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7ffff6e94800, for file <string>, line 1, in <module> ()) at Python/ceval.c:685\n#6  _PyEval_EvalCodeWithName () at Python/ceval.c:4173\n#7  PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=, kwcount=0, kws=, argcount=0, args=, locals={\'__name__\': \'__main__\', \'__doc__\': None, \'__package__\': None, \'__loader__\': <type at remote 0x555555b0eed0>, \'__spec__\': None, \'__annotations__\': {}, \'__builtins__\': <module at remote 0x7ffff6ea7180>}, globals={\'__name__\': \'__main__\', \'__doc__\': None, \'__package__\': None, \'__loader__\': <type at remote 0x555555b0eed0>, \'__spec__\': None, \'__annotations__\': {}, \'__builtins__\': <module at remote 0x7ffff6ea7180>}, _co=<code at remote 0x7ffff6e3e5d0>) at Python/ceval.c:4202\n#8  PyEval_EvalCode (co=<code at remote 0x7ffff6e3e5d0>, globals={\'__name__\': \'__main__\', \'__doc__\': None, \'__package__\': None, \'__loader__\': <type at remote 0x555555b0eed0>, \'__spec__\': None, \'__annotations__\': {}, \'__builtins__\': <module at remote 0x7ffff6ea7180>}, locals={\'__name__\': \'__main__\', \'__doc__\': None, \'__package__\': None, \'__loader__\': <type at remote 0x555555b0eed0>, \'__spec__\': None, \'__annotations__\': {}, \'__builtins__\': <module at remote 0x7ffff6ea7180>}) at Python/ceval.c:662\n#9  run_eval_code_obj () at Python/pythonrun.c:1078\n#10 run_mod () at Python/pythonrun.c:1100\n#11 PyRun_StringFlags () at Python/pythonrun.c:987\n#12 PyRun_SimpleStringFlags () at Python/pythonrun.c:461\n#13 pymain_run_command (cf=, command=<optimized out>) at Modules/main.c:241\n#14 pymain_run_python (exitcode=) at Modules/main.c:522\n#15 _Py_RunMain () at Modules/main.c:610\n#16 pymain_main () at Modules/main.c:640\n#17 _Py_UnixMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:664\n#18 __libc_start_main (main=<main>, argc=7, argv=, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=) at ../csu/libc-start.c:291\n#19 _start ()\n'
Breakpoint 1 at 0x201df0: file Python/bltinmodule.c, line 1217.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, builtin_id () at Python/bltinmodule.c:1217
1217	{
#0  builtin_id () at Python/bltinmodule.c:1217
#1  _PyMethodDef_RawFastCallKeywords () at Objects/call.c:650
#2  _PyCFunction_FastCallKeywords (func=<built-in method id of module object at remote 0x7ffff6ea7180>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Objects/call.c:736
#3  call_function (kwnames=0x0, oparg=1, pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:4831
#4  _PyEval_EvalFrameDefault () at Python/ceval.c:3347
#5  PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7ffff6e94800, for file <string>, line 1, in <module> ()) at Python/ceval.c:685
#6  _PyEval_EvalCodeWithName () at Python/ceval.c:4173
#7  PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=, kwcount=0, kws=, argcount=0, args=, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <type at remote 0x555555b0eed0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff6ea7180>}, globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <type at remote 0x555555b0eed0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff6ea7180>}, _co=<code at remote 0x7ffff6e3e5d0>) at Python/ceval.c:4202
#8  PyEval_EvalCode (co=<code at remote 0x7ffff6e3e5d0>, globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <type at remote 0x555555b0eed0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff6ea7180>}, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <type at remote 0x555555b0eed0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff6ea7180>}) at Python/ceval.c:662
#9  run_eval_code_obj () at Python/pythonrun.c:1078
#10 run_mod () at Python/pythonrun.c:1100
#11 PyRun_StringFlags () at Python/pythonrun.c:987
#12 PyRun_SimpleStringFlags () at Python/pythonrun.c:461
#13 pymain_run_command (cf=, command=<optimized out>) at Modules/main.c:241
#14 pymain_run_python (exitcode=) at Modules/main.c:522
#15 _Py_RunMain () at Modules/main.c:610
#16 pymain_main () at Modules/main.c:640
#17 _Py_UnixMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:664
#18 __libc_start_main (main=<main>, argc=7, argv=, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=) at ../csu/libc-start.c:291
#19 _start ()
msg343316 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-23 17:23
Is it just expecting builtin_id() to have been inlined? That seems risky.
msg343318 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-23 17:32
Ah no, it's expecting `builtin_id (self=..., v=...)` but getting `builtin_id ()` instead.
msg343319 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-23 18:29
Well, the good news is I can repro it on a PGO build in WSL. So now I just need to go learn all about gcc's PGO build, debug info, and how gdb renders it!
msg343343 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-24 04:32
I confirmed earlier that removing the new code from builtins_id fixes this issue, which I suspect means that PGO is deciding to make different optimizations and produce different output.

Other functions in the same stack also do not show their arguments, so I think the best thing to do here is fix the test to not care about arguments being in the display. The result of gcc's PGO on debug symbols should not affect how we make Python work.

I'll update the regex in the test tomorrow.
msg343416 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-24 17:53
Okay, fixing the regex isn't an option, as most of the tests (just not the one copy-pasted above) rely on verifying the parameter value.

I'll figure out how to skip the test on PGO build instead.
msg343422 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-24 20:00
New changeset 6de4574c6393b9cf8d7dfb0dc6ce53ee5b9ea841 by Steve Dower in branch 'master':
bpo-37023: Skip test_gdb under PGO (GH-13555)
https://github.com/python/cpython/commit/6de4574c6393b9cf8d7dfb0dc6ce53ee5b9ea841
msg343423 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-05-24 20:00
Test is now skipped if PGO was used.
History
Date User Action Args
2019-05-24 20:00:46steve.dowersetstatus: open -> closed
resolution: fixed
messages: + msg343423

stage: patch review -> resolved
2019-05-24 20:00:11steve.dowersetmessages: + msg343422
2019-05-24 17:53:40steve.dowersetkeywords: + patch
stage: patch review
pull_requests: + pull_request13466
2019-05-24 17:53:13steve.dowersetmessages: + msg343416
2019-05-24 04:32:15steve.dowersetassignee: steve.dower
messages: + msg343343
2019-05-23 18:29:42steve.dowersetmessages: + msg343319
2019-05-23 17:32:21steve.dowersetmessages: + msg343318
2019-05-23 17:23:21steve.dowersetnosy: + steve.dower
messages: + msg343316
2019-05-23 17:16:38vstinnercreate