pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
psutil.Process(pid).as_dict() Memory Error (was: CVS commit: pkgsrc/x11/py-terminator)
Kamil Rytarowski writes:
> [...]
> Change the definition of psutil_cwd() to one that works.
> [...]
> +$NetBSD: patch-terminatorlib_cwd.py,v 1.1 2019/06/01 01:17:12 kamil Exp $
> +
> +Use syntax of .cwd() that works, as_dict()['cwd'] faults.
> +Fixes terminator on NetBSD.
> +
> +--- terminatorlib/cwd.py.orig 2019-06-01 01:01:46.535724473 +0000
> ++++ terminatorlib/cwd.py
> +@@ -82,6 +82,6 @@ def sunos_get_pid_cwd(pid):
> +
> + def psutil_cwd(pid):
> + """Determine the cwd using psutil which also supports Darwin"""
> +- return psutil.Process(pid).as_dict()['cwd']
> ++ return psutil.Process(pid).cwd()
> +
> + # vim: set expandtab ts=4 sw=4:
>
JFTR, it seems that the problem is not specific to py-terminator
but a sysutils/py-psutil one.
E.g.:
| % python3.7
| Python 3.7.3 (default, May 3 2019, 17:54:14)
| [GCC 7.4.0] on netbsd8
| Type "help", "copyright", "credits" or "license" for more information.
| >>> import psutil
| >>> psutil.Process(1).as_dict()
| Traceback (most recent call last):
| File "<stdin>", line 1, in <module>
| File "/usr/pkg/lib/python3.7/site-packages/psutil/__init__.py", line 638, in as_dict
| ret = meth()
| File "/usr/pkg/lib/python3.7/site-packages/psutil/__init__.py", line 790, in cmdline
| return self._proc.cmdline()
| File "/usr/pkg/lib/python3.7/site-packages/psutil/_psbsd.py", line 562, in wrapper
| return fun(self, *args, **kwargs)
| File "/usr/pkg/lib/python3.7/site-packages/psutil/_psbsd.py", line 666, in cmdline
| return cext.proc_cmdline(self.pid)
| MemoryError
The MemoryError is from
psutil/arch/netbsd/specific.c:psutil_get_cmd_args() (that is called
via psutil_proc_cmdline() -> psutil_get_cmdline() ->
psutil_get_cmd_args()) and, unfortunately, adding debugging printf()
seems to interfere with that (i.e. calling .as_dict() succeed).
Attaching `gdb' against the Python process and trying to set a
`breakpoint' unfortunately doesn't work (i.e. the breakpoint to
psutil_get_cmd_args is set but never hit).
If anyone has any idea how to debug this further or can spot anything
please let me know!
Home |
Main Index |
Thread Index |
Old Index