New submission from Damian Myerscough: 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 ---------- messages: 261781 nosy: DamianMyerscough priority: normal severity: normal status: open title: Large Involuntary context switches during oom-killer type: resource usage versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26562> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com