This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author DamianMyerscough
Recipients DamianMyerscough
Date 2016-03-14.21:54:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457992452.77.0.650639243294.issue26562@psf.upfronthosting.co.za>
In-reply-to
Content
I have been running a simple script inside a Docker container to cause the container to trigger oom-killer.

>>> mem = {}
>>> for i in range(65535):
...     mem[i] = "A" * 65535

When oom-killer is trigger I see a large number of involuntary context switches and major page faults which causes a spike in CPU
and disk.


# /usr/bin/time --verbose python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> mem = {}
>>> for i in range(65535):
...     mem[i] = "A" * 65535
... 
Command terminated by signal 9
	Command being timed: "python"
	User time (seconds): 0.13
	System time (seconds): 3.83
	Percent of CPU this job got: 17%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:22.94
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 2096516
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 33536
	Minor (reclaiming a frame) page faults: 524545
	Voluntary context switches: 30706
	Involuntary context switches: 137852
	Swaps: 0
	File system inputs: 8499072
	File system outputs: 0
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0


I tried the same test using NodeJS/C++ and I could see a lot less involuntary context switches and major page faults which indicates this could
be a Python issue.

# /usr/bin/time --verbose ./alloc_forever 1024 5 524288000
initial_alloc_amount: 1024, sleep_duration: 5, alloc_amount: 524288000
memory: 501.07MB
memory: 1001.29MB
memory: 1501.19MB
memory: 2001.09MB
Command terminated by signal 9
	Command being timed: "./alloc_forever 1024 5 524288000"
	User time (seconds): 0.63
	System time (seconds): 0.97
	Percent of CPU this job got: 7%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:21.61
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 2096536
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 11
	Minor (reclaiming a frame) page faults: 524178
	Voluntary context switches: 17
	Involuntary context switches: 284
	Swaps: 0
	File system inputs: 336
	File system outputs: 0
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0
History
Date User Action Args
2016-03-14 21:54:12DamianMyerscoughsetrecipients: + DamianMyerscough
2016-03-14 21:54:12DamianMyerscoughsetmessageid: <1457992452.77.0.650639243294.issue26562@psf.upfronthosting.co.za>
2016-03-14 21:54:12DamianMyerscoughlinkissue26562 messages
2016-03-14 21:54:12DamianMyerscoughcreate