Summary: | [gdb/dap] ERROR: eof reading json header in gdb.dap/cond-bp.exp | ||
---|---|---|---|
Product: | gdb | Reporter: | Tom de Vries <vries> |
Component: | dap | Assignee: | Tom Tromey <tromey> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | tromey |
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | 14.1 | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | LOG.gz |
Description
Tom de Vries
2023-07-26 14:16:57 UTC
Created attachment 15013 [details]
LOG.gz
Reran with just gdb.dap/cond-bp.exp. Triggered 2 out of 100. backtrace from core file: ... (gdb) bt #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x0000000000790377 in handle_fatal_signal (sig=11) at /data/vries/gdb/src/gdb/event-top.c:912 #2 0x00000000007903ff in handle_sigsegv (sig=11) at /data/vries/gdb/src/gdb/event-top.c:962 #3 <signal handler called> #4 _PyObject_Alloc (use_calloc=0, nelem=1, elsize=60, ctx=<optimized out>) at Objects/obmalloc.c:1277 #5 0x00007f1997d33d24 in PyUnicode_New (size=11, maxchar=<optimized out>) at Objects/unicodeobject.c:1310 #6 0x00007f1997d35295 in PyUnicode_New (size=<optimized out>, maxchar=maxchar@entry=127) at Objects/unicodeobject.c:1361 #7 0x00007f197c1fafaa in ascii_escape_unicode (pystr=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:199 #8 py_encode_basestring_ascii (self=<optimized out>, pystr=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:619 #9 0x00007f197c1fc3ef in encoder_encode_string (s=0x7f197ec10138, s=0x7f197ec10138, obj='cond-bp.c') at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1437 #10 encoder_listencode_obj (s=0x7f197ec10138, acc=0x7f194f7fc3a0, obj='cond-bp.c', indent_level=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1475 #11 0x00007f197c1fcb5f in encoder_listencode_dict (indent_level=0, dct=<optimized out>, acc=0x7f194f7fc3a0, s=0x7f197ec10138) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1684 #12 encoder_listencode_obj (s=0x7f197ec10138, acc=0x7f194f7fc3a0, obj=<optimized out>, indent_level=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1502 #13 0x00007f197c1fcb5f in encoder_listencode_dict (indent_level=0, dct=<optimized out>, acc=0x7f194f7fc3a0, s=0x7f197ec10138) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1684 #14 encoder_listencode_obj (s=0x7f197ec10138, acc=0x7f194f7fc3a0, obj=<optimized out>, indent_level=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1502 #15 0x00007f197c1fcb5f in encoder_listencode_dict (indent_level=0, dct=<optimized out>, acc=0x7f194f7fc3a0, s=0x7f197ec10138) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1684 #16 encoder_listencode_obj (s=0x7f197ec10138, acc=0x7f194f7fc3a0, obj=<optimized out>, indent_level=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1502 --Type <RET> for more, q to quit, c to continue without paging-- #17 0x00007f197c1fcb5f in encoder_listencode_dict (indent_level=0, dct=<optimized out>, acc=0x7f194f7fc3a0, s=0x7f197ec10138) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1684 #18 encoder_listencode_obj (s=0x7f197ec10138, acc=0x7f194f7fc3a0, obj=<optimized out>, indent_level=<optimized out>) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1502 #19 0x00007f197c1fcfe3 in encoder_call (self=self@entry=<_json.Encoder at remote 0x7f197ec10138>, args=args@entry=({'type': 'event', 'event': 'breakpoint', 'body': {'reason': 'changed', 'breakpoint': {'id': 3, 'verified': True, 'source': {'name': 'cond-bp.c', 'sourceReference': 0, 'path': '/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.dap/cond-bp.c'}, 'line': 24, 'instructionReference': '0x4004d4'}}, 'seq': 14}, 0), kwds=kwds@entry=0x0) at /usr/src/debug/python3-core-3.6.15-150300.10.48.1.x86_64/Modules/_json.c:1363 #20 0x00007f1997ccbab9 in _PyObject_FastCallDict (func=<_json.Encoder at remote 0x7f197ec10138>, args=<optimized out>, nargs=<optimized out>, kwargs=0x0) at Objects/abstract.c:2331 #21 0x00007f1997d858aa in call_function (pp_stack=pp_stack@entry=0x7f194f7fc508, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4875 #22 0x00007f1997d89ed5 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #23 0x00007f1997d854d6 in _PyEval_EvalCodeWithName (_co=<code at remote 0x7f197eceeed0>, globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, argcount=2, kwnames=0x7f197ec93610, kwargs=0x7f197ec48cc8, kwcount=1, kwstep=1, defs=0x7f197ec93728, defcount=1, kwdefs=0x0, closure=0x0, name='iterencode', qualname='JSONEncoder.iterencode') at Python/ceval.c:4166 #24 0x00007f1997d8574f in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4992 #25 0x00007f1997d85955 in call_function (pp_stack=pp_stack@entry=0x7f194f7fc7f0, oparg=<optimized out>, kwnames=kwnames@entry=('_one_shot',)) at Python/ceval.c:4872 #26 0x00007f1997d8878e in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3351 #27 0x00007f1997d8567f in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=2, globals=<optimized out>) at Python/ceval.c:4933 #28 0x00007f1997d85816 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, --Type <RET> for more, q to quit, c to continue without paging-- kwnames=<optimized out>) at Python/ceval.c:4975 #29 0x00007f1997d85955 in call_function (pp_stack=pp_stack@entry=0x7f194f7fc988, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4872 #30 0x00007f1997d89ed5 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #31 0x00007f1997d854d6 in _PyEval_EvalCodeWithName (_co=<code at remote 0x7f197eceac00>, globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, argcount=1, kwnames=0x0, kwargs=0x7f197ec41de0, kwcount=0, kwstep=1, defs=0x0, defcount=0, kwdefs={'skipkeys': False, 'ensure_ascii': True, 'check_circular': True, 'allow_nan': True, 'cls': None, 'indent': None, 'separators': None, 'default': None, 'sort_keys': False}, closure=0x0, name='dumps', qualname='dumps') at Python/ceval.c:4166 #32 0x00007f1997d8574f in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4992 #33 0x00007f1997d85955 in call_function (pp_stack=pp_stack@entry=0x7f194f7fcc68, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4872 #34 0x00007f1997d89ed5 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #35 0x00007f1997d854d6 in _PyEval_EvalCodeWithName (_co=<code at remote 0x7f197ec358a0>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7f198c009060, argcount=0, kwnames=kwnames@entry=0x7f198c009060, kwargs=0x7f198c009068, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=(<cell at remote 0x7f197ebf9ac8>, <cell at remote 0x7f197ebf9b28>), name=0x0, qualname=0x0) at Python/ceval.c:4166 #36 0x00007f1997d85b0e in PyEval_EvalCodeEx (_co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7f198c009060, argcount=<optimized out>, kws=kws@entry=0x7f198c009060, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=(<cell at remote 0x7f197ebf9ac8>, <cell at remote 0x7f197ebf9b28>)) at Python/ceval.c:4187 #37 0x00007f1997cf5835 in function_call (func=<function at remote 0x7f197ec0ec80>, arg=(), kw={}) at Objects/funcobject.c:604 --Type <RET> for more, q to quit, c to continue without paging-- #38 0x00007f1997ccb948 in PyObject_Call (func=<function at remote 0x7f197ec0ec80>, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2261 #39 0x00007f1997d888e7 in do_call_core (kwdict={}, callargs=(), func=<function at remote 0x7f197ec0ec80>) at Python/ceval.c:5120 #40 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3404 #41 0x00007f1997d8567f in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Python/ceval.c:4933 #42 0x00007f1997d85816 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4975 #43 0x00007f1997d85955 in call_function (pp_stack=pp_stack@entry=0x7f194f7fd148, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4872 #44 0x00007f1997d89ed5 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #45 0x00007f1997d8567f in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Python/ceval.c:4933 #46 0x00007f1997d85816 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4975 #47 0x00007f1997d85955 in call_function (pp_stack=pp_stack@entry=0x7f194f7fd2e8, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4872 #48 0x00007f1997d89ed5 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #49 0x00007f1997d8567f in _PyFunction_FastCall (co=co@entry=0x7f197edc4e40, args=<optimized out>, args@entry=0x7f194f7fd490, nargs=nargs@entry=1, globals=globals@entry={'__name__': 'threading', '__doc__': "Thread module emulating a subset of Java's threading model.", '__package__': '', '__loader__': <SourceFileLoader(name='threading', path='/usr/lib64/python3.6/threading.py') at remote 0x7f197ee013c8>, '__spec__': <ModuleSpec(name='threading', loader=<...>, origin='/usr/lib64/python3.6/threading.py', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached='/usr/lib64/python3.6/__pycache__/threading.cpython-36.pyc', _initializing=False) at remote 0x7f197ee01438>, '__file__': '/usr/lib64/python3.6/thr--Type <RET> for more, q to quit, c to continue without paging-- eading.py', '__cached__': '/usr/lib64/python3.6/__pycache__/threading.cpython-36.pyc', '__builtins__': {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__package__': '', '__loader__': <type at remote 0x374dd28>, '__spec__': <ModuleSpec(name='builtins', loader=<type at remote 0x374dd28>, origin=None, loader_state=None, submodule_search_loc...(truncated)) at Python/ceval.c:4933 #50 0x00007f1997d8d870 in _PyFunction_FastCallDict (func=func@entry=<function at remote 0x7f197eda2f28>, args=args@entry=0x7f194f7fd490, nargs=1, kwargs=kwargs@entry=0x0) at Python/ceval.c:5035 #51 0x00007f1997ccbb7e in _PyObject_FastCallDict (func=<function at remote 0x7f197eda2f28>, args=0x7f194f7fd490, nargs=<optimized out>, kwargs=0x0) at Objects/abstract.c:2310 #52 0x00007f1997ccbd8c in _PyObject_Call_Prepend (func=<function at remote 0x7f197eda2f28>, obj=<optimized out>, args=(), kwargs=0x0) at Objects/abstract.c:2373 #53 0x00007f1997ccb948 in PyObject_Call (func=<method at remote 0x7f197ee3bac8>, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2261 #54 0x00007f1997d85f81 in PyEval_CallObjectWithKeywords (func=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at Python/ceval.c:4771 #55 0x00007f1997dca322 in t_bootstrap (boot_raw=boot_raw@entry=0x7f197ec01508) at ./Modules/_threadmodule.c:1000 #56 0x00007f1997dc5307 in pythread_wrapper (arg=<optimized out>) at Python/thread_pthread.h:205 #57 0x00007f1997c416ea in start_thread (arg=0x7f194f7fe700) at pthread_create.c:477 #58 0x00007f1995bda49f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 ... I was able to reproduce this. No idea what is going on here. My stack trace is a bit different: #3 0x000000000078825d in handle_sigsegv (sig=11) at ../../binutils-gdb/gdb/event-top.c:962 #4 <signal handler called> #5 0x00007f7eb3400731 in _PyUnicode_Ready () from /lib64/libpython3.10.so.1.0 #6 0x00007f7eb3270513 in _PyUnicode_JoinArray.cold () from /lib64/libpython3.10.so.1.0 #7 0x00007f7eb332af01 in PyUnicode_Join () from /lib64/libpython3.10.so.1.0 #8 0x00007f7eb33f9252 in join_list_unicode () from /lib64/libpython3.10.so.1.0 #9 0x00007f7eb3408faa in flush_accumulator () from /lib64/libpython3.10.so.1.0 #10 0x00007f7eb3408f40 in _PyAccu_FinishAsList () from /lib64/libpython3.10.so.1.0 ... Nothing interesting in the various logs. I wonder if valgrind would say something. No failures when running with valgrind. Setting PYTHONMALLOC=malloc_debug helped me find this. The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0c8a0b88d18d9c8d6cd52bd1a56d6ab88570f287 commit 0c8a0b88d18d9c8d6cd52bd1a56d6ab88570f287 Author: Tom Tromey <tromey@adacore.com> Date: Thu Jul 27 07:54:18 2023 -0600 Re-acquire GIL earlier in gdbpy_parse_and_eval Tom de Vries filed a bug about an intermittent gdb DAP failure -- and coincidentally, at the same time, Alexandra Hájková sent email about a somewhat similar failure. After looking into this for a while (with no results) using ASan and valgrind, I found that setting PYTHONMALLOC=malloc_debug found the bug instantly. The problem is that gdbpy_parse_and_eval releases the GIL while calling parse_and_eval, but fails to re-acquire it before calling value_to_value_object. This is easily fixed by introducing a new scope. I wonder whether the test suite should unconditionally set PYTHONMALLOC=malloc_debug. Tested-by: Tom de Vries <tdevries@suse.de> Reviewed-By: Tom de Vries <tdevries@suse.de> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30686 Fixed. |