我在一个Linux机器上有一个Python 2.7进程(由cron
启动),它使非常很长时间(10秒分钟)终止。
在它运行时,它使用了大量内存(25GB),并且它似乎需要花费大量时间来释放它。
strace
报道了无穷无尽的
munmap(0x7fd5cd411000, 262144) = 0
munmap(0x7fd5cb5d1000, 262144) = 0
munmap(0x7fd5cb591000, 262144) = 0
munmap(0x7fd5cb611000, 262144) = 0
munmap(0x7fd5cb551000, 262144) = 0
munmap(0x7fd5ccb11000, 262144) = 0
munmap(0x7fd5cc991000, 262144) = 0
munmap(0x7fd5cc951000, 262144) = 0
munmap(0x7fd5cc591000, 262144) = 0
munmap(0x7fd5ccb91000, 262144) = 0
munmap(0x7fd5ccb51000, 262144) = 0
munmap(0x7fd5cc291000, 262144) = 0
munmap(0x7fd5cc251000, 262144) = 0
munmap(0x7fd5cc211000, 262144) = 0
munmap(0x7fd5cc1d1000, 262144) = 0
munmap(0x7fd5cda11000, 262144) = 0
munmap(0x7fd5cd111000, 262144) = 0
munmap(0x7fd5cd0d1000, 262144) = 0
munmap(0x7fd5cc4d1000, 262144) = 0
munmap(0x7fd5cc411000, 262144) = 0
munmap(0x7fd5cc151000, 262144) = 0
munmap(0x7fd5cc091000, 262144) = 0
munmap(0x7fd5cb911000, 262144) = 0
munmap(0x7fd5cb8d1000, 262144) = 0
munmap(0x7fd5cb891000, 262144) = 0
munmap(0x7fd5cb451000, 262144) = 0
munmap(0x7fd5cb391000, 262144) = 0
munmap(0x7fd5cb3d1000, 262144) = 0
munmap(0x7fd5cb351000, 262144) = 0
munmap(0x7fd5cd5d1000, 262144) = 0
ltrace
没有任何报告。
虽然它还活着,但它使用了GDBM数据库,但很久以前就关闭了。打开的文件描述符是:
0 lr-x------ 1 sds sds 64 May 24 20:05 0 -> pipe:[36989242]
0 l-wx------ 1 sds sds 64 May 24 20:05 1 -> pipe:[36989243]
0 l-wx------ 1 sds sds 64 May 24 20:05 2 -> pipe:[36989243]
0 l-wx------ 1 sds sds 64 May 24 20:05 3 -> /home/sds/my/path/file.log
0 lr-x------ 1 sds sds 64 May 24 20:05 9 -> /dev/urandom
它不会向日志文件写任何内容。
这里发生了什么?这是Python GC的神器吗? GDBM?
我能做什么(kill
除外)?