[issue41815] SQLite: segfault if backup called on closed database
New submission from Peter McCormick : Attempting to backup a closed database will trigger segfault: ``` target = sqlite.connect(':memory:') source = sqlite.connect(":memory:") source.close() source.backup(target) ``` -- files: fix.patch keywords: patch messages: 377176 nosy: pdmccormick priority: normal severity: normal status: open title: SQLite: segfault if backup called on closed database type: crash versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49464/fix.patch ___ Python tracker <https://bugs.python.org/issue41815> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41815] SQLite: segfault if backup called on closed database
Peter McCormick added the comment: Updated sample script, thanks to @aeros for catching the omission: ``` import sqlite3 target = sqlite3.connect(':memory:') source = sqlite3.connect(':memory:') source.close() source.backup(target) ``` -- ___ Python tracker <https://bugs.python.org/issue41815> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28909] Adding LTTng-UST tracing support
Peter McCormick added the comment: I would like to propose the following patch[0] which generalizes the `PyDTrace_*` definitions to a more generic `PyProbe` structure, in anticipation of including LTTng support side-by-side with the existing DTrace support. A couple of argument types in `Include/pydtrace.h` were also changed to match those in `Include/pydtrace.d`. I can split that out to a separate, pre-PyProbe patch if that would be preferred. Some of the `*_ENABLED()` calls were reorganized such that they will actually be invoked twice (specifically in `Python/ceval.c` were the enabled check was used prior to calling helper functions, which then eventually invoked the DTrace macros.) If this won't work, we could add a sequence of guarded-by-ifdef-instead-of-enabled calls to ensure that there will only ever be one instance of any given `PyDTrace_*_ENABLED()` call. I've tested compilation on macOS with and without DTrace configured. Feedback and comments would be most welcome! Thanks, Peter [0] https://github.com/pdmccormick/cpython/commit/1e399f5ec381276b52e6a4f5a755fc0f23bd6d97 [1] https://github.com/pdmccormick/cpython/tree/bpo-28909-pyprobe-refactor -- versions: +Python 3.8 -Python 3.7 Added file: https://bugs.python.org/file47715/bpo-28909-pyprobe-refactor-20180727.patch ___ Python tracker <https://bugs.python.org/issue28909> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28909] Adding LTTng-UST tracing support
Peter McCormick added the comment: Fork at <https://github.com/pdmccormick/cpython/tree/bpo-28909-adding-lttng-ust> with Francis' original patch, plus a revert for the DTrace provider name change. Here are instructions I used to try this out: ## LTTng installation Full installation instructions for LTTng are available at <https://lttng.org/download/>. On Ubuntu 19.04 you can currently install LTTng v2.7 from the `universe` repository if it is enabled: ```shell $ apt-get install lttng-tools lttng-modules-dkms liblttng-ust-dev babeltrace ``` ## Building Clone/fetch/checkout from <https://github.com/pdmccormick/cpython/tree/bpo-28909-adding-lttng-ust> and run: ```shell $ ./configure --with-lttngust $ make ``` ## Tracing a session LTTng operates around the concept of tracing selected userspace & kernelspace events of interest within the context of a session, so let's start one and run the instrumented interpreter to see what happens: ```shell $ lttng create 'pysession' $ lttng enable-event --userspace 'cpython:*' $ lttng start $ ./python -m this $ lttng stop $ lttng view | wc -l 48257 $ lttng view [23:50:04.493873655] (+?.?) keflavik cpython:gc__start: { cpu_id = 1 }, { generation = 0 } [23:50:04.493910472] (+0.36817) keflavik cpython:gc__done: { cpu_id = 1 }, { collected = 0 } [23:50:04.494281326] (+0.000370854) keflavik cpython:gc__start: { cpu_id = 1 }, { generation = 0 } [23:50:04.494305307] (+0.23981) keflavik cpython:gc__done: { cpu_id = 1 }, { collected = 0 } [23:50:04.495031049] (+0.000725742) keflavik cpython:gc__start: { cpu_id = 1 }, { generation = 0 } [23:50:04.495074272] (+0.43223) keflavik cpython:gc__done: { cpu_id = 1 }, { collected = 0 } [23:50:04.495403759] (+0.000329487) keflavik cpython:function__entry: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 8 } [23:50:04.495405056] (+0.01297) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 8 } [23:50:04.495406486] (+0.01430) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 25 } [23:50:04.495407149] (+0.00663) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 27 } [23:50:04.495408921] (+0.01772) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 35 } [23:50:04.495409618] (+0.00697) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 42 } [23:50:04.495410775] (+0.01157) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 44 } [23:50:04.495412006] (+0.01231) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 47 } [23:50:04.495421990] (+0.09984) keflavik cpython:function__entry: { cpu_id = 1 }, { co_filename = "", co_name = "_DeadlockError", line_no = 47 } [23:50:04.495422496] (+0.00506) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "_DeadlockError", line_no = 47 } [23:50:04.495423317] (+0.00821) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "_DeadlockError", line_no = 48 } [23:50:04.495424559] (+0.01242) keflavik cpython:function__return: { cpu_id = 1 }, { co_filename = "", co_name = "_DeadlockError", line_no = 48 } [23:50:04.495468551] (+0.43992) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "", line_no = 51 } [23:50:04.495470096] (+0.01545) keflavik cpython:function__entry: { cpu_id = 1 }, { co_filename = "", co_name = "_ModuleLock", line_no = 51 } [23:50:04.495470570] (+0.00474) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "_ModuleLock", line_no = 51 } [23:50:04.495471249] (+0.00679) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "_ModuleLock", line_no = 55 } [23:50:04.495471746] (+0.00497) keflavik cpython:line: { cpu_id = 1 }, { co_filename = "", co_name = "_ModuleLock", line_no = 57 } ... ``` The raw trace files will be written under `~/lttng-traces/pysession-$TIMESTAMP`. To clean them up afterwards, you can run: ```shell $ lttng destroy ``` ## GitHub I would be happy to re-post this to GitHub issues if so desired. -- hgrepos: +367 nosy: +pdmccormick ___ Python tracker <http://bugs.python.org/issue28909> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28909] Adding LTTng-UST tracing support
Peter McCormick added the comment: A few suggestions: * Disallow `--with-lttngust` on anything other than Linux (on macOS `configure` dies due to differences in acceptable `mktemp` arguments if you even attempt it) * Rename `cpython_inst.h` to `pytrace.h` and rename `pylttngust_probes.h` to `pytrace_lttngust_probes.h` - While we're at it, rename `pydtrace.h` to `pytrace_dtrace.h`, and other mentions of `PyDTrace_*` to `PyTrace_DTrace_*`? * Define a `WITH_TRACE` or `Py_TRACE` or similar preprocessor symbol * Using that symbol, in `Python/ceval.c` ifdef-guard the static function prototypes and function calls - Otherwise when BOTH DTrace and LTTng-UST are disabled, Clang on macOS gives `warning: code will never be executed` warnings on the various arms of the `if (PyTraceEnabled(...))` statements, and GCC on Linux warn about unused variables `lineno`, `funcname` and `filename` in `pytrace_function_{entry,return}`, since the actual use of those variables as arguments is preprocessed out of existance If everyone was in agreement, would it make sense to sequence this as first the generalization-renames to the existing DTrace/SystemTap code, and then recast the LTTng addition patch on top of those? I'd be happy to do this. So, `PyTrace` or `PyTracing`? -- ___ Python tracker <http://bugs.python.org/issue28909> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28909] Adding LTTng-UST tracing support
Peter McCormick added the comment: Hi Ćukasz, thank you for the feedback! > "PyTrace" is already a name in use for a different purpose. I understand the > itch to make the name more "right" but I am in general not a fan of renaming > "PyDTrace" to anything else now. It was a placeholder from day one (SystemTap > uses it, too, after all). So, looking closer at the patch now I'd prefer us > to keep all existing names and add LTTng as another alternative engine here. > That will make the patch much shorter. What about `PyProbe`? Given the multitude of tools and techniques in this space, wouldn't it be worthwhile to clarify things before adding this? I think conflating `dtrace` and `lttng` would only lead to more confusion for users as they really are distinct technologies. Apart from the `--with{out)-dtrace` configure options, are these terms exposed to users anywhere else? I agree that those options shouldn't be changed now. -- ___ Python tracker <http://bugs.python.org/issue28909> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10933] Tracing disabled when a recursion error is triggered (even if properly handled)
Changes by Peter McCormick : -- nosy: +pdmccormick ___ Python tracker <http://bugs.python.org/issue10933> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10933] Tracing disabled when a recursion error is triggered (even if properly handled)
Peter McCormick added the comment: Removed unrelated doc changes. -- Added file: http://bugs.python.org/file38909/issue_10933-2.patch ___ Python tracker <http://bugs.python.org/issue10933> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20174] Derby #5: Convert 50 sites to Argument Clinic across 3 files
Peter McCormick added the comment: I am working on revising the Argument Clinic definitions for socketmodule.c. -- nosy: +pdmccormick ___ Python tracker <http://bugs.python.org/issue20174> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23935] Clean up Clinic's type expressions of buffers
Changes by Peter McCormick : -- nosy: +pdmccormick ___ Python tracker <http://bugs.python.org/issue23935> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23967] Make inspect.signature expression evaluation more powerful
Peter McCormick added the comment: This definitely works for the _socket.listen use case! In terms of generating such a signature using Argument Clinic, currently this is required: backlog: int(py_default="builtins.min(SOMAXCONN, 128)", c_default="Py_MIN(SOMAXCONN, 128)") = 000 The attached patch lets Tools/clinic/clinic.py make an exception when both C and Python defaults are specified, simplifying the above to: backlog: int(py_default="builtins.min(SOMAXCONN, 128)", c_default="Py_MIN(SOMAXCONN, 128)") -- keywords: +patch Added file: http://bugs.python.org/file39066/pdm-argument_clinic-mixed_py_and_c_defaults-v1.patch ___ Python tracker <http://bugs.python.org/issue23967> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23967] Make inspect.signature expression evaluation more powerful
Peter McCormick added the comment: I missed the fact that Larry's patch obviates the need for the `builtins.` prefix, shortening the Argument Clinic parameter specification into: backlog: int(py_default="min(SOMAXCONN, 128)", c_default="Py_MIN(SOMAXCONN, 128)") -- ___ Python tracker <http://bugs.python.org/issue23967> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20175] Derby #6: Convert 50 sites to Argument Clinic across 8 files
Changes by Peter McCormick : -- nosy: +pdmccormick ___ Python tracker <http://bugs.python.org/issue20175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20175] Derby #6: Convert 50 sites to Argument Clinic across 8 files
Peter McCormick added the comment: The smallest of typo fixes. -- Added file: http://bugs.python.org/file39068/pdm-iofile_typo-v1.patch ___ Python tracker <http://bugs.python.org/issue20175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com