[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Could it wait for 3.10.2 already scheduled for four weeks from now? I don't feel comfortable leaving a ton of Cython functions leaking memory constantly on many function calls. According to https://github.com/MagicStack/asyncpg/issues/874 asyncpg

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Elvis Pranskevichus
Elvis Pranskevichus added the comment: The leak was introduced in 3.10a5 (https://github.com/python/cpython/commit/0332e569c12d3dc97171546c6dc10e42c27de34b) -- ___ Python tracker

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Gregory P. Smith
Gregory P. Smith added the comment: when was the regression introduced? I wouldn't necessarily rush an urgent release out unless this was just introduced in the 3.10.1 patch release. Could it wait for 3.10.2 already scheduled for four weeks from now? -- nosy: +gregory.p.smith

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset be578e0c063dad1dbb273f86d5bc77e4e6f14583 by Yury Selivanov in branch 'main': bpo-46347: Yet another fix in the erorr path of PyEval_EvalCodeEx (#30554) https://github.com/python/cpython/commit/be578e0c063dad1dbb273f86d5bc77e4e6f14583

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 6f9ca53a6ac343a5663cc5c52546acf9a63b605a by Yury Selivanov in branch '3.10': bpo-46347: Fix PyEval_EvalCodeEx to correctly cleanup in error paths (#30553) https://github.com/python/cpython/commit/6f9ca53a6ac343a5663cc5c52546acf9a63b605a

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +28755 pull_request: https://github.com/python/cpython/pull/30554 ___ Python tracker ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +28754 pull_request: https://github.com/python/cpython/pull/30553 ___ Python tracker ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 20b5791ce9b47195ce51cfd5acb223b1ca59cdf0 by Yury Selivanov in branch 'main': bpo-46347: Fix PyEval_EvalCodeEx to correctly cleanup in error paths (#30551) https://github.com/python/cpython/commit/20b5791ce9b47195ce51cfd5acb223b1ca59cdf0

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: > The function will still leak "kwnames" and "default" if creating the "func" > object fails. Yeah, here's another PR to address that: https://github.com/python/cpython/pull/30551 -- ___ Python tracker

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +28752 pull_request: https://github.com/python/cpython/pull/30551 ___ Python tracker ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread STINNER Victor
STINNER Victor added the comment: The memory leak has been fixed in 3.10 and main branches. Can this issue be closed now? -- components: +Interpreter Core versions: +Python 3.10, Python 3.11 ___ Python tracker

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread miss-islington
miss-islington added the comment: New changeset b1a94f1fab7c0aee0705483616a1b2c3f2713c00 by Miss Islington (bot) in branch '3.10': bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (GH-30546) https://github.com/python/cpython/commit/b1a94f1fab7c0aee0705483616a1b2c3f2713c00 --

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Apparently, this is causing adyncpg to leak megabytes in seconds -- ___ Python tracker ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Larry Hastings
Larry Hastings added the comment: (Sorry--it'll leak "kwnames", "newargs", and "defaults".) -- ___ Python tracker ___ ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Larry Hastings
Larry Hastings added the comment: The function will still leak "kwnames" and "default" if creating the "func" object fails. Admittedly that would only happen in a low-memory condition which is a) rare and b) probably only happens just before the interpreter completely dies, so it's not

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Turns out this leak affects CYthon quite a lot: https://github.com/cython/cython/blob/29ad96444b8b1a4f05a6ac2328fde01de4782691/Cython/Utility/ObjectHandling.c#L2139-L2155 This seems to imply that every function call using __Pyx_PyCFunction_FastCall

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 607d8a838f29ad3c4c4e85b39f338dade5f9cafe by Yury Selivanov in branch 'main': bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (#30546) https://github.com/python/cpython/commit/607d8a838f29ad3c4c4e85b39f338dade5f9cafe --

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 5.0 -> 6.0 pull_requests: +28750 pull_request: https://github.com/python/cpython/pull/30549 ___ Python tracker

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +28746 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30546 ___ Python tracker ___

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Elvis Pranskevichus
Elvis Pranskevichus added the comment: I can confirm that removing the kwargs allocation prevents the leak described in the asyncpg issue from happening. -- ___ Python tracker

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: This is the questionable place in the code: https://github.com/python/cpython/blob/dce642f24418c58e67fa31a686575c980c31dd37/Python/ceval.c#L6131-L6166 See that `kwargs` is allocated but never freed or used. --

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
Yury Selivanov added the comment: (this is the context of our current investigation btw: https://github.com/MagicStack/asyncpg/issues/874#issuecomment-1009383262) -- ___ Python tracker

[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov
New submission from Yury Selivanov : I'm investigating a memory leak in 3.10, and while looking at the offending commit I stumbled upon this: in ceval.c:PyEval_EvalCodeEx, there's this allocation: PyObject **kwargs = PyMem_Malloc(sizeof(PyObject *)*kwcount); The problem is that this