Export to GitHub

psutil - issue #502

"TypeError: argument 2 to map() must support iteration" in process.memory_maps


Posted on May 8, 2014 by Happy Ox

Got the following stacktrace in a production application:

File "thermos_executor/twitter/aurora/executor/executor_vars.py", line 91, in aggregate_memory return sum(getattr(mmap, attribute) for mmap in process.get_memory_maps()) File "/root/.pex/install/psutil-1.1.2-py2.6-linux-x86_64.egg/psutil/init.py", line 790, in get_memory_maps d[path] = map(lambda x, y: x+y, d[path], nums) TypeError: argument 2 to map() must support iteration

What version of psutil are you using? What Python version? psutil 1.1.2 Python 2.6.8

On what operating system? Is it 32bit or 64bit version? Linux x86_64 2.6.50 custom kernel on EL5

Please provide any additional information below.

This has happened once after running in production for quite a while, so it seems extremely rare. I check psutil 2.1.1 and the code is still there roughly unchanged, so I figure it might still happen in production. It seems it's possible for "path" to repeat multiple times in the loop such that d[path] is no longer an iterable.

Comment #1

Posted on May 8, 2014 by Happy Monkey

Mmmm this is gonna be hard to figure out without knowing what "path" was. In order to get that error "path" should be something different than a string (e.g. None) but acccording to the source code "path" is always supposed to be a string: https://code.google.com/p/psutil/source/browse/psutil/_pslinux.py?name=release-1.1.2#673 ...so I really have no idea how that can happen without further inputs on your part. I'd say try to upgrade to latest psutil version (1.1.2 is way too old) but for this specific problem I guess that wouldn't help either as apparently that part of the code is identical.

Comment #2

Posted on May 26, 2014 by Happy Monkey

psutil has been migrated from Google Code to Github (see: http://grodola.blogspot.com/2014/05/goodbye-google-code-im-moving-to-github.html). Please do NOT reply here but use this instead: https://github.com/giampaolo/psutil/issues/502

Status: New

Labels:
Type-Defect Priority-Medium OpSys-Linux